/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('apig', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AiServiceConfig {
  address?: string(name='address', example='https://dashscope.aliyun.com'),
  apiKeys?: [ string ](name='apiKeys'),
  enableHealthCheck?: boolean(name='enableHealthCheck'),
  protocols?: [ string ](name='protocols'),
  provider?: string(name='provider', example='qwen'),
}

model AkSkIdentityConfig {
  ak?: string(name='ak'),
  generateMode?: string(name='generateMode'),
  sk?: string(name='sk'),
  type?: string(name='type'),
}

model ApiKeyIdentityConfig {
  apikeySource?: {
    source?: string(name='source'),
    value?: string(name='value'),
  }(name='apikeySource'),
  credentials?: [ 
    {
      apikey?: string(name='apikey'),
      generateMode?: string(name='generateMode'),
    }
  ](name='credentials'),
  type?: string(name='type'),
}

model ApiRouteConflictInfo {
  conflicts?: [ 
    {
      details?: [ 
        {
          conflictingMatch?: {
            match?: HttpRouteMatch(name='match'),
            operationInfo?: {
              name?: string(name='name'),
              operationId?: string(name='operationId'),
            }(name='operationInfo'),
          }(name='conflictingMatch'),
          detectedMatch?: {
            match?: HttpRouteMatch(name='match'),
            operationInfo?: {
              name?: string(name='name'),
              operationId?: string(name='operationId'),
            }(name='operationInfo'),
          }(name='detectedMatch'),
          level?: string(name='level'),
        }
      ](name='details'),
      environmentInfo?: {
        environmentId?: string(name='environmentId'),
        name?: string(name='name'),
      }(name='environmentInfo'),
      resourceId?: string(name='resourceId'),
      resourceName?: string(name='resourceName'),
      resourceType?: string(name='resourceType'),
      routeInfo?: {
        name?: string(name='name'),
        routeId?: string(name='routeId'),
      }(name='routeInfo'),
    }
  ](name='conflicts'),
  domainInfo?: {
    domainId?: string(name='domainId'),
    name?: string(name='name'),
  }(name='domainInfo'),
}

model Attachment {
  attachResourceIds?: [ string ](name='attachResourceIds'),
  attachResourceType?: string(name='attachResourceType'),
  environmentId?: string(name='environmentId'),
  gatewayId?: string(name='gatewayId'),
  policyAttachmentId?: string(name='policyAttachmentId'),
}

model AuthConfig {
  authMode?: string(name='authMode'),
  authType?: string(name='authType'),
}

model AuthorizationResourceInfo {
  environmentId?: string(name='environmentId'),
  parentResourceId?: string(name='parentResourceId'),
  resourceId?: string(name='resourceId'),
}

model Backend {
  scene?: string(name='scene', example='Single'),
  services?: [ 
    {
      name?: string(name='name', example='item-service'),
      port?: int32(name='port', example='port'),
      protocol?: string(name='protocol', example='HTTP'),
      serviceId?: string(name='serviceId', example='service-cq2bmmdlhtgj***'),
      version?: string(name='version', example='v1'),
      weight?: int32(name='weight', example='49'),
    }
  ](name='services'),
}

model CheckServiceLinkedRoleResult {
  existed?: boolean(name='existed'),
}

model ConsumerInfo {
  consumerId?: string(name='consumerId'),
  enable?: boolean(name='enable'),
  name?: string(name='name'),
}

model DashboardFilter {
  routeName?: string(name='routeName', example='test'),
}

model DomainInfo {
  certIdentifier?: string(name='certIdentifier'),
  clientCACert?: string(name='clientCACert'),
  createFrom?: string(name='createFrom'),
  createTimestamp?: long(name='createTimestamp'),
  domainId?: string(name='domainId'),
  forceHttps?: boolean(name='forceHttps'),
  mTLSEnabled?: boolean(name='mTLSEnabled'),
  name?: string(name='name'),
  protocol?: string(name='protocol'),
  resourceGroupId?: string(name='resourceGroupId', example='rg-xxxx'),
  status?: string(name='status'),
  updateTimestamp?: long(name='updateTimestamp'),
}

model EnvironmentInfo {
  alias?: string(name='alias'),
  createTimestamp?: long(name='createTimestamp'),
  default?: boolean(name='default'),
  description?: string(name='description'),
  environmentId?: string(name='environmentId'),
  gatewayInfo?: GatewayInfo(name='gatewayInfo'),
  name?: string(name='name'),
  resourceGroupId?: string(name='resourceGroupId', example='rg-xxxx'),
  subDomainInfos?: [
    SubDomainInfo
  ](name='subDomainInfos'),
  updateTimestamp?: long(name='updateTimestamp'),
}

model GatewayInfo {
  engineVersion?: string(name='engineVersion'),
  gatewayId?: string(name='gatewayId'),
  name?: string(name='name'),
  vpcInfo?: {
    name?: string(name='name'),
    vpcId?: string(name='vpcId'),
  }(name='vpcInfo'),
}

model GatewayLogConfig {
  slsConfig?: {
    enable?: boolean(name='enable'),
  }(name='slsConfig'),
}

model HttpApiApiInfo {
  aiProtocols?: [ string ](name='aiProtocols'),
  authConfig?: AuthConfig(name='authConfig'),
  basePath?: string(name='basePath', example='/v1'),
  deployConfigs?: [
    HttpApiDeployConfig
  ](name='deployConfigs'),
  description?: string(name='description'),
  enabelAuth?: boolean(name='enabelAuth'),
  environments?: [ 
    {
      alias?: string(name='alias', example='test'),
      backendScene?: string(name='backendScene', example='SingleService'),
      backendType?: string(name='backendType', example='Service'),
      customDomains?: [
        HttpApiDomainInfo
      ](name='customDomains'),
      deployStatus?: string(name='deployStatus', example='Deployed'),
      environmentId?: string(name='environmentId', example='env-xxx'),
      gatewayInfo?: {
        gatewayId?: string(name='gatewayId', example='gw-xxx'),
        name?: string(name='name', example='test'),
      }(name='gatewayInfo'),
      name?: string(name='name', example='test'),
      serviceConfigs?: [ 
        {
          gatewayServiceId?: string(name='gatewayServiceId', example='gs-xxx'),
          match?: HttpApiBackendMatchConditions(name='match'),
          name?: string(name='name', example='demo-service'),
          port?: string(name='port', example='8080'),
          protocol?: string(name='protocol', example='HTTP'),
          serviceId?: string(name='serviceId', example='svc-xxx'),
          version?: string(name='version', example='v1'),
          weight?: int32(name='weight', example='100'),
        }
      ](name='serviceConfigs'),
      subDomains?: [ 
        {
          domainId?: string(name='domainId', example='d-xxx'),
          name?: string(name='name', example='www.example.com'),
          networkType?: string(name='networkType', example='Internet'),
          protocol?: string(name='protocol', example='HTTP'),
        }
      ](name='subDomains'),
    }
  ](name='environments'),
  httpApiId?: string(name='httpApiId', example='api-xxx'),
  ingressInfo?: {
    environmentInfo?: {
      environmentId?: string(name='environmentId'),
    }(name='environmentInfo'),
    ingressClass?: string(name='ingressClass'),
    k8sClusterInfo?: {
      clusterId?: string(name='clusterId'),
    }(name='k8sClusterInfo'),
    overrideIngressIp?: boolean(name='overrideIngressIp'),
    sourceId?: string(name='sourceId'),
    watchNamespace?: string(name='watchNamespace'),
  }(name='ingressInfo'),
  name?: string(name='name', example='test'),
  protocols?: [ string ](name='protocols'),
  resourceGroupId?: string(name='resourceGroupId', example='rg-xxx'),
  type?: string(name='type', example='Rest'),
  versionInfo?: HttpApiVersionInfo(name='versionInfo'),
}

model HttpApiBackendMatchCondition {
  key?: string(name='key', example='color'),
  operator?: string(name='operator', example='equal'),
  type?: string(name='type', example='Query'),
  value?: string(name='value', example='gray'),
}

model HttpApiBackendMatchConditions {
  conditions?: [
    HttpApiBackendMatchCondition
  ](name='conditions'),
  default?: boolean(name='default', example='true'),
}

model HttpApiDeployConfig {
  autoDeploy?: boolean(name='autoDeploy', example='true'),
  backendScene?: string(name='backendScene', example='SingleService'),
  customDomainIds?: [ string ](name='customDomainIds'),
  environmentId?: string(name='environmentId', example='env-xxx'),
  policyConfigs?: [ 
    {
      aiFallbackConfig?: {
        serviceIds?: [ string ](name='serviceIds'),
      }(name='aiFallbackConfig'),
      enable?: boolean(name='enable', example='true'),
      type?: string(name='type', example='AiFallback'),
    }
  ](name='policyConfigs'),
  serviceConfigs?: [ 
    {
      modelName?: string(name='modelName', example='qwen-max'),
      modelNamePattern?: string(name='modelNamePattern', example='qwen-*'),
      serviceId?: string(name='serviceId', example='svc-xxx'),
      weight?: long(name='weight', example='100'),
    }
  ](name='serviceConfigs'),
}

model HttpApiDomainInfo {
  domainId?: string(name='domainId', example='d-xxx'),
  name?: string(name='name', example='www.example.com'),
  protocol?: string(name='protocol', example='HTTP'),
}

model HttpApiInfoByName {
  name?: string(name='name', example='test-api'),
  type?: string(name='type', example='Http'),
  versionEnabled?: boolean(name='versionEnabled', example='true'),
  versionedHttpApis?: [
    HttpApiApiInfo
  ](name='versionedHttpApis'),
}

model HttpApiMockContract {
  enable?: boolean(name='enable', example='false'),
  responseCode?: int32(name='responseCode', example='200'),
  responseContent?: string(name='responseContent'),
}

model HttpApiOperation {
  authConfig?: AuthConfig(name='authConfig'),
  description?: string(name='description', example='获取用户信息'),
  enableAuth?: boolean(name='enableAuth'),
  method?: string(name='method', description='This parameter is required.', example='GET'),
  mock?: HttpApiMockContract(name='mock'),
  name?: string(name='name', description='This parameter is required.', example='GetUserInfo'),
  path?: string(name='path', description='This parameter is required.', example='/user'),
  request?: HttpApiRequestContract(name='request'),
  response?: HttpApiResponseContract(name='response'),
}

model HttpApiOperationInfo {
  authConfig?: AuthConfig(name='authConfig'),
  createTimestamp?: long(name='createTimestamp', example='1719386834548'),
  description?: string(name='description', example='获取用户信息'),
  enableAuth?: boolean(name='enableAuth'),
  method?: string(name='method', example='GET'),
  mock?: HttpApiMockContract(name='mock'),
  name?: string(name='name', example='GetUserInfo'),
  operationId?: string(name='operationId', example='op-xxx'),
  path?: string(name='path', example='/user/123'),
  request?: HttpApiRequestContract(name='request'),
  response?: HttpApiResponseContract(name='response'),
}

model HttpApiParameter {
  defaultValue?: string(name='defaultValue'),
  description?: string(name='description'),
  exampleValue?: string(name='exampleValue'),
  name?: string(name='name', description='This parameter is required.'),
  required?: boolean(name='required', example='false'),
  type?: string(name='type', description='This parameter is required.', example='string'),
}

model HttpApiPublishRevisionInfo {
  backendScene?: string(name='backendScene', example='SingleService'),
  backendType?: string(name='backendType', example='Service'),
  cloudProductConfig?: {
    cloudProductType?: string(name='cloudProductType', example='FC'),
    containerServiceConfigs?: [ 
      {
        gatewayServiceId?: string(name='gatewayServiceId', example='gs-xxx'),
        match?: HttpApiBackendMatchConditions(name='match'),
        name?: string(name='name', example='demo-service'),
        namespace?: string(name='namespace', example='default'),
        port?: int32(name='port', example='8080'),
        protocol?: string(name='protocol', example='HTTP'),
        weight?: string(name='weight', example='100'),
      }
    ](name='containerServiceConfigs'),
    functionConfigs?: [ 
      {
        gatewayServiceId?: string(name='gatewayServiceId', example='gs-xxx'),
        match?: HttpApiBackendMatchConditions(name='match'),
        name?: string(name='name', example='demo-function'),
        qualifier?: string(name='qualifier', example='LATEST'),
        weight?: int32(name='weight', example='100'),
      }
    ](name='functionConfigs'),
    mseNacosConfigs?: [ 
      {
        gatewayServiceId?: string(name='gatewayServiceId', example='gs-xxx'),
        groupName?: string(name='groupName', example='DEFAULT_GROUP'),
        match?: HttpApiBackendMatchConditions(name='match'),
        name?: string(name='name', example='spring-demo'),
        namespace?: string(name='namespace', example='public'),
        weight?: int32(name='weight', example='100'),
      }
    ](name='mseNacosConfigs'),
  }(name='cloudProductConfig'),
  createTimestamp?: long(name='createTimestamp', example='1718807057927'),
  customDomains?: [
    HttpApiDomainInfo
  ](name='customDomains'),
  dnsConfigs?: [ 
    {
      dnsList?: [ string ](name='dnsList'),
      match?: HttpApiBackendMatchConditions(name='match'),
      weight?: int32(name='weight', example='100'),
    }
  ](name='dnsConfigs'),
  environmentInfo?: {
    alias?: string(name='alias', example='测试'),
    environmentId?: string(name='environmentId', example='env-xxx'),
    gatewayInfo?: {
      gatewayId?: string(name='gatewayId', example='gw-xxx'),
      name?: string(name='name', example='实例1'),
    }(name='gatewayInfo'),
    name?: string(name='name', example='test'),
  }(name='environmentInfo', example='env-xxx'),
  isCurrentVersion?: boolean(name='isCurrentVersion', example='true'),
  operations?: [
    HttpApiOperationInfo
  ](name='operations'),
  revisionId?: string(name='revisionId', example='apr-xxx'),
  serviceConfigs?: [ 
    {
      gatewayServiceId?: string(name='gatewayServiceId', example='gs-xxx'),
      match?: HttpApiBackendMatchConditions(name='match'),
      port?: int32(name='port', example='8080'),
      protocol?: string(name='protocol', example='HTTP'),
      version?: string(name='version', example='v1'),
      weight?: int32(name='weight', example='100'),
    }
  ](name='serviceConfigs'),
  subDomains?: [
    HttpApiDomainInfo
  ](name='subDomains', example='env-xxx.com'),
  vipConfigs?: [ 
    {
      endpoints?: [ string ](name='endpoints'),
      match?: HttpApiBackendMatchConditions(name='match'),
      weight?: int32(name='weight', example='100'),
    }
  ](name='vipConfigs'),
}

model HttpApiRequestContract {
  body?: {
    contentType?: string(name='contentType', example='application/json'),
    description?: string(name='description'),
    example?: string(name='example', example='{"key":"value"}'),
    jsonSchema?: string(name='jsonSchema'),
  }(name='body'),
  headerParameters?: [
    HttpApiParameter
  ](name='headerParameters'),
  pathParameters?: [
    HttpApiParameter
  ](name='pathParameters'),
  queryParameters?: [
    HttpApiParameter
  ](name='queryParameters'),
}

model HttpApiResponseContract {
  contentType?: string(name='contentType', description='This parameter is required.', example='application/json'),
  items?: [ 
    {
      code?: int32(name='code', example='200'),
      description?: string(name='description', example='正常接口响应'),
      example?: string(name='example', example='{"result": "ok"}'),
      jsonSchema?: string(name='jsonSchema'),
    }
  ](name='items'),
}

model HttpApiVersionConfig {
  enable?: boolean(name='enable', example='true'),
  headerName?: string(name='headerName', example='my-version'),
  queryName?: string(name='queryName', example='myVersion'),
  scheme?: string(name='scheme', example='Query'),
  version?: string(name='version', example='v1'),
}

model HttpApiVersionInfo {
  enable?: boolean(name='enable', example='true'),
  headerName?: string(name='headerName', example='my-version'),
  queryName?: string(name='queryName', example='myVersion'),
  scheme?: string(name='scheme', example='Query'),
  version?: string(name='version', example='v1'),
}

model HttpDubboTranscoder {
  dubboServiceGroup?: string(name='dubboServiceGroup'),
  dubboServiceName?: string(name='dubboServiceName'),
  dubboServiceVersion?: string(name='dubboServiceVersion'),
  mothedMapList?: [ 
    {
      dubboMothedName?: string(name='dubboMothedName'),
      httpMothed?: string(name='httpMothed', example='ALL_GET'),
      mothedpath?: string(name='mothedpath', example='/mytestzbk/sayhello'),
      paramMapsList?: [ 
        {
          extractKey?: string(name='extractKey', example='name'),
          extractKeySpec?: string(name='extractKeySpec', example='ALL_QUERY_PARAMETER'),
          mappingType?: string(name='mappingType', example='java.lang.String'),
        }
      ](name='paramMapsList'),
      passThroughAllHeaders?: string(name='passThroughAllHeaders', example='PASS_NOT'),
      passThroughList?: [ string ](name='passThroughList'),
    }
  ](name='mothedMapList'),
}

model HttpRoute {
  backend?: Backend(name='backend'),
  createTimestamp?: long(name='createTimestamp'),
  deployStatus?: string(name='deployStatus'),
  description?: string(name='description'),
  domainInfos?: [ 
    {
      domainId?: string(name='domainId'),
      name?: string(name='name'),
      protocol?: string(name='protocol'),
    }
  ](name='domainInfos'),
  environmentInfo?: {
    alias?: string(name='alias'),
    environmentId?: string(name='environmentId'),
    gatewayInfo?: {
      gatewayId?: string(name='gatewayId'),
      name?: string(name='name'),
    }(name='gatewayInfo'),
    name?: string(name='name'),
    subDomains?: [ 
      {
        domainId?: string(name='domainId'),
        name?: string(name='name'),
        networkType?: string(name='networkType', example='Internet'),
        protocol?: string(name='protocol'),
      }
    ](name='subDomains'),
  }(name='environmentInfo'),
  match?: HttpRouteMatch(name='match'),
  name?: string(name='name'),
  routeId?: string(name='routeId'),
  updateTimestamp?: long(name='updateTimestamp'),
}

model HttpRouteMatch {
  headers?: [ 
    {
      name?: string(name='name', example='dev'),
      type?: string(name='type', example='Exact'),
      value?: string(name='value', example='true'),
    }
  ](name='headers'),
  ignoreUriCase?: boolean(name='ignoreUriCase', example='true'),
  methods?: [ string ](name='methods'),
  path?: {
    type?: string(name='type', example='Prefix'),
    value?: string(name='value', example='/user'),
  }(name='path'),
  queryParams?: [ 
    {
      name?: string(name='name', example='age'),
      type?: string(name='type', example='Exact'),
      value?: string(name='value', example='17'),
    }
  ](name='queryParams'),
}

model JwtIdentityConfig {
  jwks?: string(name='jwks'),
  jwtPayloadConfig?: {
    payloadKeyName?: string(name='payloadKeyName'),
    payloadKeyValue?: string(name='payloadKeyValue'),
  }(name='jwtPayloadConfig'),
  jwtTokenConfig?: {
    key?: string(name='key'),
    pass?: boolean(name='pass'),
    position?: string(name='position'),
    prefix?: string(name='prefix'),
  }(name='jwtTokenConfig'),
  secretType?: string(name='secretType'),
  type?: string(name='type'),
}

model ParentResourceInfo {
  apiInfo?: HttpApiApiInfo(name='apiInfo'),
  resourceType?: string(name='resourceType'),
}

model PluginClassInfo {
  alias?: string(name='alias'),
  configExample?: string(name='configExample'),
  description?: string(name='description'),
  executePriority?: int32(name='executePriority'),
  executeStage?: string(name='executeStage'),
  imageName?: string(name='imageName'),
  innerPlugin?: boolean(name='innerPlugin'),
  mode?: string(name='mode'),
  name?: string(name='name'),
  pluginClassId?: string(name='pluginClassId'),
  source?: string(name='source'),
  supportedMinGatewayVersion?: string(name='supportedMinGatewayVersion'),
  type?: string(name='type'),
  version?: string(name='version'),
  versionDescription?: string(name='versionDescription'),
  wasmLanguage?: string(name='wasmLanguage'),
  wasmUrl?: string(name='wasmUrl'),
}

model PolicyClassInfo {
  alias?: string(name='alias'),
  attachableResourceTypes?: [ string ](name='attachableResourceTypes'),
  classId?: string(name='classId'),
  configExample?: string(name='configExample'),
  deprecated?: boolean(name='deprecated'),
  description?: string(name='description'),
  direction?: string(name='direction'),
  enableLog?: boolean(name='enableLog'),
  executePriority?: string(name='executePriority'),
  executeStage?: string(name='executeStage'),
  name?: string(name='name'),
  type?: string(name='type'),
  version?: string(name='version'),
}

model PolicyDetailInfo {
  classId?: string(name='classId'),
  className?: string(name='className'),
  config?: string(name='config'),
  description?: string(name='description'),
  name?: string(name='name'),
  policyId?: string(name='policyId'),
}

model PolicyInfo {
  attachments?: [
    Attachment
  ](name='attachments'),
  classAlias?: string(name='classAlias'),
  className?: string(name='className'),
  config?: string(name='config'),
  direction?: string(name='direction'),
  executePriority?: string(name='executePriority'),
  executeStage?: string(name='executeStage'),
  name?: string(name='name'),
  policyId?: string(name='policyId'),
  type?: string(name='type'),
}

model ResourceInfo {
  resourceId?: string(name='resourceId'),
  resourceName?: string(name='resourceName'),
  resourceType?: string(name='resourceType'),
  resourceVersion?: string(name='resourceVersion'),
}

model ResourceStatistic {
  resourceCount?: int32(name='resourceCount'),
  resourceType?: string(name='resourceType'),
}

model Service {
  addresses?: [ string ](name='addresses'),
  aiServiceConfig?: AiServiceConfig(name='aiServiceConfig'),
  createTimestamp?: long(name='createTimestamp'),
  gatewayId?: string(name='gatewayId', example='gw-xxxx'),
  groupName?: string(name='groupName', example='publich'),
  healthCheck?: ServiceHealthCheck(name='healthCheck'),
  healthStatus?: string(name='healthStatus'),
  name?: string(name='name'),
  namespace?: string(name='namespace'),
  ports?: [ 
    {
      name?: string(name='name'),
      port?: int32(name='port'),
      protocol?: string(name='protocol'),
    }
  ](name='ports'),
  protocol?: string(name='protocol', example='HTTP'),
  qualifier?: string(name='qualifier', example='LATEST'),
  resourceGroupId?: string(name='resourceGroupId', example='rg-xxx'),
  serviceId?: string(name='serviceId'),
  sourceType?: string(name='sourceType'),
  unhealthyEndpoints?: [ string ](name='unhealthyEndpoints'),
  updateTimestamp?: long(name='updateTimestamp'),
}

model ServiceHealthCheck {
  enable?: boolean(name='enable', example='true'),
  healthyThreshold?: int32(name='healthyThreshold'),
  httpHost?: string(name='httpHost'),
  httpPath?: string(name='httpPath'),
  interval?: int32(name='interval'),
  protocol?: string(name='protocol', example='TCP'),
  timeout?: int32(name='timeout'),
  unhealthyThreshold?: int32(name='unhealthyThreshold'),
}

model ServiceLinkedRole {
  arn?: string(name='arn'),
  assumeRolePolicyDocument?: string(name='assumeRolePolicyDocument'),
  createDate?: string(name='createDate'),
  description?: string(name='description'),
  isServiceLinkedRole?: boolean(name='isServiceLinkedRole'),
  roleId?: string(name='roleId'),
  roleName?: string(name='roleName'),
  rolePrincipalName?: string(name='rolePrincipalName'),
}

model SslCertMetaInfo {
  algorithm?: string(name='algorithm'),
  certId?: long(name='certId'),
  certIdentifier?: string(name='certIdentifier'),
  certName?: string(name='certName'),
  commonName?: string(name='commonName'),
  domain?: string(name='domain'),
  domainMatchCert?: boolean(name='domainMatchCert'),
  fingerprint?: string(name='fingerprint'),
  instanceId?: string(name='instanceId'),
  isChainCompleted?: boolean(name='isChainCompleted'),
  issuer?: string(name='issuer'),
  keySize?: string(name='keySize'),
  md5?: string(name='md5'),
  notAfterTimestamp?: long(name='notAfterTimestamp'),
  notBeforeTimestamp?: long(name='notBeforeTimestamp'),
  sans?: string(name='sans'),
  serialNo?: string(name='serialNo'),
  sha2?: string(name='sha2'),
  signAlgorithm?: string(name='signAlgorithm'),
}

model SubDomainInfo {
  domainId?: string(name='domainId'),
  name?: string(name='name'),
  networkType?: string(name='networkType'),
  protocol?: string(name='protocol'),
}

model TlsCipherSuitesConfig {
  configType?: string(name='configType'),
  tlsCipherSuite?: [ 
    {
      name?: string(name='name'),
      supportVersions?: [ string ](name='supportVersions'),
    }
  ](name='tlsCipherSuite'),
}

model AddGatewaySecurityGroupRuleRequest {
  description?: string(name='description', description='Description of the security group rule.', example='商品中心访问安全组'),
  portRanges?: [ string ](name='portRanges', description='Port ranges.'),
  securityGroupId?: string(name='securityGroupId', description='Security group ID.', example='sg-wz929kxhcdp****'),
}

model AddGatewaySecurityGroupRuleResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='2A6E90D5-A711-54F4-A489-E33C2021EDDF'),
}

model AddGatewaySecurityGroupRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddGatewaySecurityGroupRuleResponseBody(name='body'),
}

/**
 * @summary Authorize the security group for gateway to access services
 *
 * @param request AddGatewaySecurityGroupRuleRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddGatewaySecurityGroupRuleResponse
 */
async function addGatewaySecurityGroupRuleWithOptions(gatewayId: string, request: AddGatewaySecurityGroupRuleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AddGatewaySecurityGroupRuleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.portRanges)) {
    body['portRanges'] = request.portRanges;
  }
  if (!Util.isUnset(request.securityGroupId)) {
    body['securityGroupId'] = request.securityGroupId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddGatewaySecurityGroupRule',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/security-group-rules`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Authorize the security group for gateway to access services
 *
 * @param request AddGatewaySecurityGroupRuleRequest
 * @return AddGatewaySecurityGroupRuleResponse
 */
async function addGatewaySecurityGroupRule(gatewayId: string, request: AddGatewaySecurityGroupRuleRequest): AddGatewaySecurityGroupRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return addGatewaySecurityGroupRuleWithOptions(gatewayId, request, headers, runtime);
}

model ChangeResourceGroupRequest {
  resourceGroupId?: string(name='ResourceGroupId', description='Target resource group ID.', example='rg-aekzdrfx2xdnaja'),
  resourceId?: string(name='ResourceId', description='Resource ID', example='gw-ct4i14um1hkn0tpqfae0'),
  resourceType?: string(name='ResourceType', description='Resource type', example='gateway'),
  service?: string(name='Service', description='Service name, fixed value apig', example='apig'),
}

model ChangeResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='Request ID.', example='59F86F37-787A-52DB-9475-DB5A255517F0'),
}

model ChangeResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeResourceGroupResponseBody(name='body'),
}

/**
 * @summary Resource Group Transfer
 *
 * @param request ChangeResourceGroupRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroupWithOptions(request: ChangeResourceGroupRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ChangeResourceGroupResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.service)) {
    query['Service'] = request.service;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ChangeResourceGroup',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/move-resource-group`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Resource Group Transfer
 *
 * @param request ChangeResourceGroupRequest
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroup(request: ChangeResourceGroupRequest): ChangeResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return changeResourceGroupWithOptions(request, headers, runtime);
}

model CreateDomainRequest {
  caCertIdentifier?: string(name='caCertIdentifier', description='The CA certificate ID.', example='1ef1da5f-38ed-69b3-****-037781890265'),
  certIdentifier?: string(name='certIdentifier', description='The certificate ID.', example='1ef1da5f-38ed-69b3-****-037781890265'),
  clientCACert?: string(name='clientCACert', description='The client CA certificate.', example='-----BEGIN CERTIFICATE-----
MIIFBTCCAu2gAwIBAgIUORLpYPGSFD1YOP6PMbE7Wd/mpTQwDQYJKoZIhvcNAQEL
BQAwE************************************************2VwVOJ2gqX3
YuGaxvIbDy0iQJ1GMerPRyzJTeVEtdIKT29u0PdFRr4KZWom35qX7G4=
-----END CERTIFICATE-----'),
  forceHttps?: boolean(name='forceHttps', description='Specifies whether to enable forcible HTTPS redirection.', example='false'),
  http2Option?: string(name='http2Option', description='The HTTP/2 configuration.

Valid values:

*   GlobalConfig
*   Close
*   Open', example='Open'),
  mTLSEnabled?: boolean(name='mTLSEnabled', description='Specifies whether to enable mutual authentication.'),
  name?: string(name='name', description='The domain name.

This parameter is required.', example='abc.com'),
  protocol?: string(name='protocol', description='The protocol type supported by the domain name.

*   HTTP: Only HTTP is supported.
*   HTTPS: Only HTTPS is supported.

This parameter is required.', example='HTTP'),
  resourceGroupId?: string(name='resourceGroupId', description='The [resource group ID](https://help.aliyun.com/document_detail/151181.html).', example='rg-aekzoiafjtr7zyq'),
  tlsCipherSuitesConfig?: TlsCipherSuitesConfig(name='tlsCipherSuitesConfig', description='The cipher suite configuration.'),
  tlsMax?: string(name='tlsMax', description='The maximum version of the TLS protocol. Up to TLS 1.3 is supported.', example='TLS1.3'),
  tlsMin?: string(name='tlsMin', description='The minimum version of the TLS protocol. Down to TLS 1.0 is supported.', example='TLS1.0'),
}

model CreateDomainResponseBody = {
  code?: string(name='code', description='The status code returned.', example='Ok'),
  data?: {
    domainId?: string(name='domainId', description='The ID of the domain name.', example='d-cpu1aullhtgkidg7sa4g'),
  }(name='data', description='The response data.'),
  message?: string(name='message', description='The response message returned.', example='success'),
  requestId?: string(name='requestId', description='The request ID, which is used to trace the API call link.', example='0C2D1C68-0D93-5561-8EE6-FDB7BF067A30'),
}

model CreateDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDomainResponseBody(name='body'),
}

/**
 * @summary Creates a domain name.
 *
 * @description Create Domain.
 *
 * @param request CreateDomainRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDomainResponse
 */
async function createDomainWithOptions(request: CreateDomainRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDomainResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.caCertIdentifier)) {
    body['caCertIdentifier'] = request.caCertIdentifier;
  }
  if (!Util.isUnset(request.certIdentifier)) {
    body['certIdentifier'] = request.certIdentifier;
  }
  if (!Util.isUnset(request.clientCACert)) {
    body['clientCACert'] = request.clientCACert;
  }
  if (!Util.isUnset(request.forceHttps)) {
    body['forceHttps'] = request.forceHttps;
  }
  if (!Util.isUnset(request.http2Option)) {
    body['http2Option'] = request.http2Option;
  }
  if (!Util.isUnset(request.mTLSEnabled)) {
    body['mTLSEnabled'] = request.mTLSEnabled;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.protocol)) {
    body['protocol'] = request.protocol;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tlsCipherSuitesConfig)) {
    body['tlsCipherSuitesConfig'] = request.tlsCipherSuitesConfig;
  }
  if (!Util.isUnset(request.tlsMax)) {
    body['tlsMax'] = request.tlsMax;
  }
  if (!Util.isUnset(request.tlsMin)) {
    body['tlsMin'] = request.tlsMin;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateDomain',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/domains`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a domain name.
 *
 * @description Create Domain.
 *
 * @param request CreateDomainRequest
 * @return CreateDomainResponse
 */
async function createDomain(request: CreateDomainRequest): CreateDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDomainWithOptions(request, headers, runtime);
}

model CreateEnvironmentRequest {
  alias?: string(name='alias', description='Environment alias.

This parameter is required.', example='测试环境'),
  description?: string(name='description', description='Description of the environment, which can include information such as the purpose of the environment and its owner.', example='这是xxx的xx项目测试环境'),
  gatewayId?: string(name='gatewayId', description='Gateway ID.

This parameter is required.', example='gw-cq7l5s5lhtgi6qasrdc0'),
  name?: string(name='name', description='Environment name.

This parameter is required.', example='test'),
  resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group.', example='rg-acfmycs5expl7oq'),
}

model CreateEnvironmentResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  data?: {
    environmentId?: string(name='environmentId', description='Environment ID.', example='env-cq7l5s5lhtgi6qasrdc0'),
  }(name='data', description='Response data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID, used for tracing the API call chain.', example='3C3B9A12-3868-5EB9-8BEA-F99E03DD125C'),
}

model CreateEnvironmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateEnvironmentResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI CreateEnvironment is deprecated
 *
 * @summary CreateEnvironment
 *
 * @description Create environment.
 *
 * @param request CreateEnvironmentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateEnvironmentResponse
 */
// Deprecated
async function createEnvironmentWithOptions(request: CreateEnvironmentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateEnvironmentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.alias)) {
    body['alias'] = request.alias;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.gatewayId)) {
    body['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['resourceGroupId'] = request.resourceGroupId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateEnvironment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/environments`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @deprecated OpenAPI CreateEnvironment is deprecated
 *
 * @summary CreateEnvironment
 *
 * @description Create environment.
 *
 * @param request CreateEnvironmentRequest
 * @return CreateEnvironmentResponse
 */
// Deprecated
async function createEnvironment(request: CreateEnvironmentRequest): CreateEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createEnvironmentWithOptions(request, headers, runtime);
}

model CreateHttpApiRequest {
  aiProtocols?: [ string ](name='aiProtocols', description='The AI API protocols. Valid value:

*   OpenAI/v1'),
  authConfig?: AuthConfig(name='authConfig', description='The authentication configurations.'),
  basePath?: string(name='basePath', description='The API base path, which must start with a forward slash (/).', example='/v1'),
  deployConfigs?: [
    HttpApiDeployConfig
  ](name='deployConfigs', description='The API deployment configurations. Currently, only AI APIs support deployment configurations, and only a single deployment configuration can be passed.'),
  description?: string(name='description', description='The API description.', example='API for testing'),
  enableAuth?: boolean(name='enableAuth', description='Specifies whether to enable authentication.'),
  ingressConfig?: {
    environmentId?: string(name='environmentId', description='The environment ID.', example='env-cq146allhtgk***'),
    ingressClass?: string(name='ingressClass', description='The Ingress Class for listening.', example='mse'),
    overrideIngressIp?: boolean(name='overrideIngressIp', description='Specifies whether to update the address in Ingress Status.', example='false'),
    sourceId?: string(name='sourceId', description='The source ID.', example='src-crdddallhtgtr***'),
    watchNamespace?: string(name='watchNamespace', description='The namespace for listening.', example='default'),
  }(name='ingressConfig', description='The HTTP Ingress configurations.'),
  name?: string(name='name', description='The API name.

This parameter is required.', example='test-api'),
  protocols?: [ string ](name='protocols', description='The protocols that are used to call the API.'),
  resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-aekzgvmlotionbi'),
  type?: string(name='type', description='The API type. Valid values:

*   Http
*   Rest
*   WebSocket
*   HttpIngress', example='Http'),
  versionConfig?: HttpApiVersionConfig(name='versionConfig', description='The versioning configuration of the API.'),
}

model CreateHttpApiResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    httpApiId?: string(name='httpApiId', description='The HTTP API ID.', example='api-xxx'),
    name?: string(name='name', description='The API name.', example='test-api'),
  }(name='data', description='The API information.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='A1994B10-C6A8-58FA-8347-6A08B0D4EFDE'),
}

model CreateHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateHttpApiResponseBody(name='body'),
}

/**
 * @summary Creates an HTTP API.
 *
 * @param request CreateHttpApiRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateHttpApiResponse
 */
async function createHttpApiWithOptions(request: CreateHttpApiRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateHttpApiResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.aiProtocols)) {
    body['aiProtocols'] = request.aiProtocols;
  }
  if (!Util.isUnset(request.authConfig)) {
    body['authConfig'] = request.authConfig;
  }
  if (!Util.isUnset(request.basePath)) {
    body['basePath'] = request.basePath;
  }
  if (!Util.isUnset(request.deployConfigs)) {
    body['deployConfigs'] = request.deployConfigs;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.enableAuth)) {
    body['enableAuth'] = request.enableAuth;
  }
  if (!Util.isUnset(request.ingressConfig)) {
    body['ingressConfig'] = request.ingressConfig;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.protocols)) {
    body['protocols'] = request.protocols;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.type)) {
    body['type'] = request.type;
  }
  if (!Util.isUnset(request.versionConfig)) {
    body['versionConfig'] = request.versionConfig;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates an HTTP API.
 *
 * @param request CreateHttpApiRequest
 * @return CreateHttpApiResponse
 */
async function createHttpApi(request: CreateHttpApiRequest): CreateHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createHttpApiWithOptions(request, headers, runtime);
}

model CreateHttpApiOperationRequest {
  operations?: [
    HttpApiOperation
  ](name='operations', description='List of operation definitions.'),
}

model CreateHttpApiOperationResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    operations?: [ 
      {
        operationId?: string(name='operationId', description='Operation ID.', example='op-xxx'),
      }
    ](name='operations', description='Operation information.'),
  }(name='data', description='Operation information.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='393E2630-DBE7-5221-AB35-9E740675491A'),
}

model CreateHttpApiOperationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateHttpApiOperationResponseBody(name='body'),
}

/**
 * @summary Create an Operation for HTTP API
 *
 * @param request CreateHttpApiOperationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateHttpApiOperationResponse
 */
async function createHttpApiOperationWithOptions(httpApiId: string, request: CreateHttpApiOperationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateHttpApiOperationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.operations)) {
    body['operations'] = request.operations;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateHttpApiOperation',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/operations`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Create an Operation for HTTP API
 *
 * @param request CreateHttpApiOperationRequest
 * @return CreateHttpApiOperationResponse
 */
async function createHttpApiOperation(httpApiId: string, request: CreateHttpApiOperationRequest): CreateHttpApiOperationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createHttpApiOperationWithOptions(httpApiId, request, headers, runtime);
}

model CreateHttpApiRouteRequest {
  backendConfig?: {
    scene?: string(name='scene', description='The scenario of the backend service.

*   SingleService
*   MultiServiceByRatio
*   Mock
*   Redirect', example='SingleService'),
    services?: [ 
      {
        port?: int32(name='port', description='The service port. If you want to use a dynamic port, do not pass this parameter.', example='8080'),
        protocol?: string(name='protocol', description='The protocol. Valid values:

*   HTTP
*   HTTPS', example='HTTP'),
        serviceId?: string(name='serviceId', description='The service ID.', example='svc-crbgq0dlhtgr***'),
        version?: string(name='version', description='The service version. Pass this parameter for tag-based routing.', example='v1'),
        weight?: int32(name='weight', description='The percentage value of traffic.', example='49'),
      }
    ](name='services', description='The backend services.'),
  }(name='backendConfig', description='The backend service configurations of the route.'),
  description?: string(name='description', description='The route description.', example='User logon route'),
  domainIds?: [ string ](name='domainIds', description='The domain name IDs.'),
  environmentId?: string(name='environmentId', description='The environment ID.', example='env-cpqnr6tlhtgubcv***'),
  match?: HttpRouteMatch(name='match', description='The rule for matching the route.'),
  name?: string(name='name', description='The route name.', example='login'),
}

model CreateHttpApiRouteResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    routeId?: string(name='routeId', description='The route ID.', example='hr-cr82undlhtgrlej***'),
  }(name='data', description='The response data.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='3ACFC7A7-45A9-58CF-B2D5-765B60254695'),
}

model CreateHttpApiRouteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateHttpApiRouteResponseBody(name='body'),
}

/**
 * @summary Creates a route for an HTTP API.
 *
 * @param request CreateHttpApiRouteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateHttpApiRouteResponse
 */
async function createHttpApiRouteWithOptions(httpApiId: string, request: CreateHttpApiRouteRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateHttpApiRouteResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.backendConfig)) {
    body['backendConfig'] = request.backendConfig;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.domainIds)) {
    body['domainIds'] = request.domainIds;
  }
  if (!Util.isUnset(request.environmentId)) {
    body['environmentId'] = request.environmentId;
  }
  if (!Util.isUnset(request.match)) {
    body['match'] = request.match;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateHttpApiRoute',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/routes`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a route for an HTTP API.
 *
 * @param request CreateHttpApiRouteRequest
 * @return CreateHttpApiRouteResponse
 */
async function createHttpApiRoute(httpApiId: string, request: CreateHttpApiRouteRequest): CreateHttpApiRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createHttpApiRouteWithOptions(httpApiId, request, headers, runtime);
}

model CreatePolicyRequest {
  className?: string(name='className', description='Policy type, including RateLimit, ConcurrencyLimit, CircuitBreaker, HttpRewrite, HeaderModify, Cors, Authentication, FlowCopy, Timeout, Retry, IpAccessControl, DirectResponse, Redirect, Fallback, ServiceTls, ServiceLb, ServicePortTls, Waf, JWTAuth, OIDCAuth, ExternalZAuth, AiProxy, ModelRouter, AiStatistics, AiSecurityGuard, AiFallback, ModelMapper, AiTokenRateLimit, AiCache, DynamicRoute

This parameter is required.', example='Timeout'),
  config?: string(name='config', description='Policy configuration

This parameter is required.', example='{"unitNum":1,"timeUnit":"s","enable":true}'),
  description?: string(name='description', description='Policy description', example='timeout policy'),
  name?: string(name='name', description='Policy name

This parameter is required.', example='test-policy'),
}

model CreatePolicyResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    policyId?: string(name='policyId', description='Policy ID', example='p-cq7l5s5lhtgi6qasr***'),
  }(name='data', description='Response data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='ID of the request', example='393E2630-DBE7-5221-AB35-9E7406754***'),
}

model CreatePolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePolicyResponseBody(name='body'),
}

/**
 * @summary Create Policy
 *
 * @param request CreatePolicyRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePolicyResponse
 */
async function createPolicyWithOptions(request: CreatePolicyRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePolicyResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.className)) {
    body['className'] = request.className;
  }
  if (!Util.isUnset(request.config)) {
    body['config'] = request.config;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePolicy',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v2/policies`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Create Policy
 *
 * @param request CreatePolicyRequest
 * @return CreatePolicyResponse
 */
async function createPolicy(request: CreatePolicyRequest): CreatePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPolicyWithOptions(request, headers, runtime);
}

model CreatePolicyAttachmentRequest {
  attachResourceId?: string(name='attachResourceId', description='Attached resource ID

This parameter is required.', example='api-cu07jj6m1hkokaus***'),
  attachResourceType?: string(name='attachResourceType', description='Attached resource type, such as HttpApi, GatewayRoute, Operation, GatewayService, GatewayServicePort, Gateway, Domain

This parameter is required.', example='HttpApi'),
  environmentId?: string(name='environmentId', description='Environment ID

This parameter is required.', example='env-cquqsollhtgid***'),
  gatewayId?: string(name='gatewayId', description='Gateway instance ID

This parameter is required.', example='gw-cq7l5s5lhtgi6qas***'),
  policyId?: string(name='policyId', description='Policy ID

This parameter is required.', example='p-cq787etlhtghrptjg***'),
}

model CreatePolicyAttachmentResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  data?: {
    policyAttachmentId?: string(name='policyAttachmentId', description='Policy Mount ID', example='pr-cqooju5lhtgquuj6***'),
  }(name='data', description='Response data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='ID of the request', example='585657D2-1C20-5B8A-AF17-D727C64***'),
}

model CreatePolicyAttachmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePolicyAttachmentResponseBody(name='body'),
}

/**
 * @summary Create policy resource mount
 *
 * @param request CreatePolicyAttachmentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePolicyAttachmentResponse
 */
async function createPolicyAttachmentWithOptions(request: CreatePolicyAttachmentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePolicyAttachmentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.attachResourceId)) {
    body['attachResourceId'] = request.attachResourceId;
  }
  if (!Util.isUnset(request.attachResourceType)) {
    body['attachResourceType'] = request.attachResourceType;
  }
  if (!Util.isUnset(request.environmentId)) {
    body['environmentId'] = request.environmentId;
  }
  if (!Util.isUnset(request.gatewayId)) {
    body['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.policyId)) {
    body['policyId'] = request.policyId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePolicyAttachment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/policy-attachments`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Create policy resource mount
 *
 * @param request CreatePolicyAttachmentRequest
 * @return CreatePolicyAttachmentResponse
 */
async function createPolicyAttachment(request: CreatePolicyAttachmentRequest): CreatePolicyAttachmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPolicyAttachmentWithOptions(request, headers, runtime);
}

model CreateServiceRequest {
  gatewayId?: string(name='gatewayId', description='The gateway instance ID.', example='gw-cq7l5s5lhtg***'),
  resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-xxx'),
  serviceConfigs?: [ 
    {
      addresses?: [ string ](name='addresses', description='The list of domain names or fixed addresses.'),
      aiServiceConfig?: AiServiceConfig(name='aiServiceConfig', description='The AI service configurations.'),
      dnsServers?: [ string ](name='dnsServers', description='The list of DNS service addresses.'),
      groupName?: string(name='groupName', description='The service group name. This parameter is required if sourceType is set to MSE_NACOS.', example='DEFAULT_GROUP'),
      name?: string(name='name', description='The service name.', example='user-service'),
      namespace?: string(name='namespace', description='The service namespace. This parameter is required when sourceType is set to K8S or MSE_NACOS.

*   If sourceType is set to K8S, this parameter specifies the namespace where the K8s service resides.
*   If sourceType is set to MSE_NACOS, this parameter specifies a namespace in Nacos.', example='PUBLIC'),
      qualifier?: string(name='qualifier', description='The function version or alias.', example='LATEST'),
    }
  ](name='serviceConfigs', description='The list of service configurations.'),
  sourceType?: string(name='sourceType', description='The service source. Valid values:

*   MSE_NACOS: a service in an MSE Nacos instance
*   K8S: a service in a Kubernetes (K8s) cluster in Container Service for Kubernetes (ACK)
*   VIP: a fixed IP address
*   DNS: a Domain Name System (DNS) domain name
*   FC3: a service in Function Compute
*   SAE_K8S_SERVICE: a service in a K8s cluster in Serverless App Engine (SAE)

Enumerated values:

*   SAE_K8S_SERVICE
*   K8S
*   FC3
*   DNS
*   VIP
*   MSE_NACOS', example='MSE_NACOS'),
}

model CreateServiceResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    serviceIds?: [ string ](name='serviceIds', description='The list of service IDs.'),
  }(name='data', description='The response data.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='C67DED2B-F19B-5BEC-88C1-D6EB854CD0D4'),
}

model CreateServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateServiceResponseBody(name='body'),
}

/**
 * @summary Creates a service.
 *
 * @description You can call this operation to create multiple services at a time.
 *
 * @param request CreateServiceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateServiceResponse
 */
async function createServiceWithOptions(request: CreateServiceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.gatewayId)) {
    body['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serviceConfigs)) {
    body['serviceConfigs'] = request.serviceConfigs;
  }
  if (!Util.isUnset(request.sourceType)) {
    body['sourceType'] = request.sourceType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateService',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/services`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a service.
 *
 * @description You can call this operation to create multiple services at a time.
 *
 * @param request CreateServiceRequest
 * @return CreateServiceResponse
 */
async function createService(request: CreateServiceRequest): CreateServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createServiceWithOptions(request, headers, runtime);
}

model DeleteDomainResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID, used for tracing the API call chain.', example='A60EE5CA-1294-532A-9775-8D2FD1C6EFBF'),
}

model DeleteDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDomainResponseBody(name='body'),
}

/**
 * @summary DeleteDomain
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDomainResponse
 */
async function deleteDomainWithOptions(domainId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDomainResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteDomain',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/domains/${OpenApiUtil.getEncodeParam(domainId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary DeleteDomain
 *
 * @return DeleteDomainResponse
 */
async function deleteDomain(domainId: string): DeleteDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDomainWithOptions(domainId, headers, runtime);
}

model DeleteEnvironmentResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID, used for tracing the request chain.', example='C61E30D3-579A-5B43-994E-31E02EDC9129'),
}

model DeleteEnvironmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteEnvironmentResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI DeleteEnvironment is deprecated
 *
 * @summary DeleteEnvironment
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteEnvironmentResponse
 */
// Deprecated
async function deleteEnvironmentWithOptions(environmentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteEnvironmentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteEnvironment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/environments/${OpenApiUtil.getEncodeParam(environmentId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @deprecated OpenAPI DeleteEnvironment is deprecated
 *
 * @summary DeleteEnvironment
 *
 * @return DeleteEnvironmentResponse
 */
// Deprecated
async function deleteEnvironment(environmentId: string): DeleteEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteEnvironmentWithOptions(environmentId, headers, runtime);
}

model DeleteGatewayResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='DE97DFDB-7DF0-5AB9-941C-10D27D769E4B'),
}

model DeleteGatewayResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteGatewayResponseBody(name='body'),
}

/**
 * @summary Delete Gateway
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteGatewayResponse
 */
async function deleteGatewayWithOptions(gatewayId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteGatewayResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteGateway',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete Gateway
 *
 * @return DeleteGatewayResponse
 */
async function deleteGateway(gatewayId: string): DeleteGatewayResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteGatewayWithOptions(gatewayId, headers, runtime);
}

model DeleteGatewaySecurityGroupRuleRequest {
  cascadingDelete?: boolean(name='cascadingDelete', description='Whether to cascade delete the security group rules.', example='true'),
}

model DeleteGatewaySecurityGroupRuleResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='8F94B3CC-F4BA-511E-8367-ECBBE486E595'),
}

model DeleteGatewaySecurityGroupRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteGatewaySecurityGroupRuleResponseBody(name='body'),
}

/**
 * @summary Delete the security group rule of a gateway
 *
 * @param request DeleteGatewaySecurityGroupRuleRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteGatewaySecurityGroupRuleResponse
 */
async function deleteGatewaySecurityGroupRuleWithOptions(gatewayId: string, securityGroupRuleId: string, request: DeleteGatewaySecurityGroupRuleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteGatewaySecurityGroupRuleResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cascadingDelete)) {
    query['cascadingDelete'] = request.cascadingDelete;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteGatewaySecurityGroupRule',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/security-group-rules/${OpenApiUtil.getEncodeParam(securityGroupRuleId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete the security group rule of a gateway
 *
 * @param request DeleteGatewaySecurityGroupRuleRequest
 * @return DeleteGatewaySecurityGroupRuleResponse
 */
async function deleteGatewaySecurityGroupRule(gatewayId: string, securityGroupRuleId: string, request: DeleteGatewaySecurityGroupRuleRequest): DeleteGatewaySecurityGroupRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteGatewaySecurityGroupRuleWithOptions(gatewayId, securityGroupRuleId, request, headers, runtime);
}

model DeleteHttpApiResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='5B626361-070A-56A7-B127-ADAC8F3655DB'),
}

model DeleteHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteHttpApiResponseBody(name='body'),
}

/**
 * @summary Deletes an HTTP API.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteHttpApiResponse
 */
async function deleteHttpApiWithOptions(httpApiId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteHttpApiResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes an HTTP API.
 *
 * @return DeleteHttpApiResponse
 */
async function deleteHttpApi(httpApiId: string): DeleteHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteHttpApiWithOptions(httpApiId, headers, runtime);
}

model DeleteHttpApiOperationResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message,', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='585657D2-1C20-5B8A-AF17-D727C6490BE4'),
}

model DeleteHttpApiOperationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteHttpApiOperationResponseBody(name='body'),
}

/**
 * @summary Delete Operation
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteHttpApiOperationResponse
 */
async function deleteHttpApiOperationWithOptions(httpApiId: string, operationId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteHttpApiOperationResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteHttpApiOperation',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/operations/${OpenApiUtil.getEncodeParam(operationId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete Operation
 *
 * @return DeleteHttpApiOperationResponse
 */
async function deleteHttpApiOperation(httpApiId: string, operationId: string): DeleteHttpApiOperationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteHttpApiOperationWithOptions(httpApiId, operationId, headers, runtime);
}

model DeleteHttpApiRouteResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='0F138FFC-6E2B-56C1-9BAB-A67462E339D1'),
}

model DeleteHttpApiRouteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteHttpApiRouteResponseBody(name='body'),
}

/**
 * @summary Delete the route of an HttpApi
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteHttpApiRouteResponse
 */
async function deleteHttpApiRouteWithOptions(httpApiId: string, routeId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteHttpApiRouteResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteHttpApiRoute',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/routes/${OpenApiUtil.getEncodeParam(routeId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete the route of an HttpApi
 *
 * @return DeleteHttpApiRouteResponse
 */
async function deleteHttpApiRoute(httpApiId: string, routeId: string): DeleteHttpApiRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteHttpApiRouteWithOptions(httpApiId, routeId, headers, runtime);
}

model DeletePolicyResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='ID of the request', example='393E2630-DBE7-5221-AB35-9E7406754***'),
}

model DeletePolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeletePolicyResponseBody(name='body'),
}

/**
 * @summary Delete Policy
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeletePolicyResponse
 */
async function deletePolicyWithOptions(policyId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeletePolicyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeletePolicy',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v2/policies/${OpenApiUtil.getEncodeParam(policyId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete Policy
 *
 * @return DeletePolicyResponse
 */
async function deletePolicy(policyId: string): DeletePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deletePolicyWithOptions(policyId, headers, runtime);
}

model DeletePolicyAttachmentResponseBody = {
  code?: string(name='code', description='Response status code.', example='200'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='ID of the request', example='CE857A85-251D-5018-8103-A38957D71***'),
}

model DeletePolicyAttachmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeletePolicyAttachmentResponseBody(name='body'),
}

/**
 * @summary Delete policy resource attachment
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeletePolicyAttachmentResponse
 */
async function deletePolicyAttachmentWithOptions(policyAttachmentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeletePolicyAttachmentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeletePolicyAttachment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/policy-attachments/${OpenApiUtil.getEncodeParam(policyAttachmentId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Delete policy resource attachment
 *
 * @return DeletePolicyAttachmentResponse
 */
async function deletePolicyAttachment(policyAttachmentId: string): DeletePolicyAttachmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deletePolicyAttachmentWithOptions(policyAttachmentId, headers, runtime);
}

model DeployHttpApiRequest {
  restApiConfig?: {
    description?: string(name='description', description='Publication description.', example='用户服务API发布。'),
    environment?: {
      backendScene?: string(name='backendScene', description='API publication scenario.', example='SingleService'),
      customDomainIds?: [ string ](name='customDomainIds', description='List of user domains.'),
      environmentId?: string(name='environmentId', description='Environment ID.', example='env-cpqnr6tlhtgubc***'),
      serviceConfigs?: [ 
        {
          match?: HttpApiBackendMatchConditions(name='match', description='Configuration of matching conditions related to API deployment.'),
          port?: int32(name='port', description='Service port, do not provide for dynamic ports.', example='8080'),
          protocol?: string(name='protocol', description='Service protocol:
- HTTP.
- HTTPS.', example='HTTP'),
          serviceId?: string(name='serviceId', description='Service ID.', example='svc-cr6pk4tlhtgm58e***'),
          version?: string(name='version', description='Service version.', example='v1'),
          weight?: int32(name='weight', description='Weight, range [1,100], valid only in the by-ratio scenario.', example='49'),
        }
      ](name='serviceConfigs', description='Existing service configurations. Only one entry is allowed in a single-service scenario, while multiple entries are allowed in scenarios such as by ratio or by content.'),
    }(name='environment', description='Publication environment configuration.'),
    revisionId?: string(name='revisionId', description='Historical version number. If this field is specified, the publication information will be based on the historical version information.', example='apr-xxx'),
  }(name='restApiConfig', description='Rest API deployment configuration. Required when deploying an HTTP API as a Rest API.'),
  routeId?: string(name='routeId', description='Route ID. This must be provided when publishing the route of an HTTP API.', example='hr-cr82undlhtgrl***'),
}

model DeployHttpApiResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='响应消息。', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='0C2D1C68-0D93-5561-8EE6-FDB7BF067A30'),
}

model DeployHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeployHttpApiResponseBody(name='body'),
}

/**
 * @summary Deploy HttpApi
 *
 * @param request DeployHttpApiRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeployHttpApiResponse
 */
async function deployHttpApiWithOptions(httpApiId: string, request: DeployHttpApiRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeployHttpApiResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.restApiConfig)) {
    body['restApiConfig'] = request.restApiConfig;
  }
  if (!Util.isUnset(request.routeId)) {
    body['routeId'] = request.routeId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeployHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/deploy`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deploy HttpApi
 *
 * @param request DeployHttpApiRequest
 * @return DeployHttpApiResponse
 */
async function deployHttpApi(httpApiId: string, request: DeployHttpApiRequest): DeployHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deployHttpApiWithOptions(httpApiId, request, headers, runtime);
}

model ExportHttpApiResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    specContentBase64?: string(name='specContentBase64', description='Base64编码的API定义。', example='b3BlbmFwaTogMy4wLjAKaW5mbzoKICAgIHRpdGxlOiBkZW1vCiAgICBkZXNjcmlwdGlvbjogdGhpc2lzZGVtbwogICAgdmVyc2lvbjogIiIKcGF0aHM6CiAgICAvdXNlci97dXNlcklkfToKICAgICAgICBnZXQ6CiAgICAgICAgICAgIHN1bW1hcnk6IOiOt+WPlueUqOaIt+S/oeaBrwogICAgICAgICAgICBkZXNjcmlwdGlvbjog6I635Y+W55So5oi35L+h5oGvCiAgICAgICAgICAgIG9wZXJhdGlvbklkOiBHZXRVc2VySW5mbwogICAgICAgICAgICByZXNwb25zZXM6CiAgICAgICAgICAgICAgICAiMjAwIjoKICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjog5oiQ5YqfCiAgICAgICAgICAgICAgICAgICAgY29udGVudDoKICAgICAgICAgICAgICAgICAgICAgICAgYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PXV0Zi04OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NoZW1hOiBudWxsCnNlcnZlcnM6CiAgICAtIHVybDogaHR0cDovL2FwaS5leGFtcGxlLmNvbS92MQo='),
  }(name='data', description='API definition information.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='4BACB05C-3FE2-588F-9148-700C5C026B74'),
}

model ExportHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExportHttpApiResponseBody(name='body'),
}

/**
 * @summary Export HTTP API
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExportHttpApiResponse
 */
async function exportHttpApiWithOptions(httpApiId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ExportHttpApiResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ExportHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/export`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Export HTTP API
 *
 * @return ExportHttpApiResponse
 */
async function exportHttpApi(httpApiId: string): ExportHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return exportHttpApiWithOptions(httpApiId, headers, runtime);
}

model GetDashboardRequest {
  acceptLanguage?: string(name='acceptLanguage', description='The language. Valid values: zh (Chinese) and en (English).', example='zh'),
  apiId?: string(name='apiId', description='API ID', example='api-c9uuekzmia8q2****'),
  filter?: {
    routeName?: string(name='routeName', description='The route name.', example='test-route'),
  }(name='filter', description='The filter configurations.'),
  name?: string(name='name', description='The dashboard name.

*   LOG: access logs
*   PLUGIN: plug-in logs', example='PLUGIN'),
  pluginClassId?: string(name='pluginClassId', description='The plug-in ID.', example='pls-dn82a9djd8z****'),
  pluginId?: string(name='pluginId'),
  source?: string(name='source', description='The dashboard source. Valid values:

*   SLS: Simple Log Service', example='SLS'),
  upstreamCluster?: string(name='upstreamCluster'),
}

model GetDashboardShrinkRequest {
  acceptLanguage?: string(name='acceptLanguage', description='The language. Valid values: zh (Chinese) and en (English).', example='zh'),
  apiId?: string(name='apiId', description='API ID', example='api-c9uuekzmia8q2****'),
  filterShrink?: string(name='filter', description='The filter configurations.'),
  name?: string(name='name', description='The dashboard name.

*   LOG: access logs
*   PLUGIN: plug-in logs', example='PLUGIN'),
  pluginClassId?: string(name='pluginClassId', description='The plug-in ID.', example='pls-dn82a9djd8z****'),
  pluginId?: string(name='pluginId'),
  source?: string(name='source', description='The dashboard source. Valid values:

*   SLS: Simple Log Service', example='SLS'),
  upstreamCluster?: string(name='upstreamCluster'),
}

model GetDashboardResponseBody = {
  code?: int32(name='code', description='The HTTP status code.', example='200'),
  data?: {
    gatewayId?: string(name='gatewayId', description='The instance ID.', example='gw-co370icmjeu****'),
    name?: string(name='name', description='The dashboard name.', example='PLUGIN'),
    title?: string(name='title', description='The dashboard title.', example='APIG Plugin'),
    url?: string(name='url', description='The dashboard URL.', example='https://sls.console.aliyun.com/lognext/project/xxxxx'),
  }(name='data', description='The data returned.'),
  errorCode?: string(name='errorCode', description='The error code.', example='Ok'),
  message?: string(name='message', description='The error message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='2F46B9E7-67EF-5C8A-BA52-D38D5B32AF2C'),
  success?: boolean(name='success', description='Indicates whether the request was successful.', example='true'),
}

model GetDashboardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDashboardResponseBody(name='body'),
}

/**
 * @summary Obtains data from dashboards.
 *
 * @param tmpReq GetDashboardRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDashboardResponse
 */
async function getDashboardWithOptions(gatewayId: string, tmpReq: GetDashboardRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDashboardResponse {
  Util.validateModel(tmpReq);
  var request = new GetDashboardShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'filter', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['acceptLanguage'] = request.acceptLanguage;
  }
  if (!Util.isUnset(request.apiId)) {
    query['apiId'] = request.apiId;
  }
  if (!Util.isUnset(request.filterShrink)) {
    query['filter'] = request.filterShrink;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.pluginClassId)) {
    query['pluginClassId'] = request.pluginClassId;
  }
  if (!Util.isUnset(request.pluginId)) {
    query['pluginId'] = request.pluginId;
  }
  if (!Util.isUnset(request.source)) {
    query['source'] = request.source;
  }
  if (!Util.isUnset(request.upstreamCluster)) {
    query['upstreamCluster'] = request.upstreamCluster;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDashboard',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/dashboards`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Obtains data from dashboards.
 *
 * @param request GetDashboardRequest
 * @return GetDashboardResponse
 */
async function getDashboard(gatewayId: string, request: GetDashboardRequest): GetDashboardResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDashboardWithOptions(gatewayId, request, headers, runtime);
}

model GetDomainRequest {
  withStatistics?: boolean(name='withStatistics', description='Specifies whether to return online resource information.', example='true'),
}

model GetDomainResponseBody = {
  code?: string(name='code', description='The status code returned.', example='Ok'),
  data?: {
    algorithm?: string(name='algorithm', description='The encryption algorithm.', example='RSA'),
    caCertIdentifier?: string(name='caCertIdentifier', description='The CA certificate ID.', example='876****-cn-hangzhou'),
    certIdentifier?: string(name='certIdentifier', description='The certificate ID.', example='645****-cn-hangzhou'),
    certName?: string(name='certName', description='The certificate name.', example='test-cert'),
    clientCACert?: string(name='clientCACert', description='The client CA certificate.', example='-----BEGIN CERTIFICATE-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/mpTQwDQYJKoZIhvcNAQEL
BxSbrGeJ8i0576Gn7Qezyho9abZOUhGaPeoB
AIHWWl428uUSG/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy+ZMJ8r4swA4swHwYDVR0jBBgwFoAU
qroVyYKk7ylhcSn+ZMJ8r4swA4swDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
-----END CERTIFICATE-----'),
    createFrom?: string(name='createFrom', description='The creation source.

Valid values:

*   Console
*   Ingress', example='Console'),
    createTimestamp?: long(name='createTimestamp', description='The creation timestamp.', example='1719386834548'),
    default?: boolean(name='default', description='Indicates whether the domain name is the default domain name.', example='false'),
    domainId?: string(name='domainId', description='The ID of the domain name.', example='d-cq1m3utlhtgvgkv7sitg'),
    forceHttps?: boolean(name='forceHttps', description='Indicates whether forcible HTTPS redirection is enabled.', example='false'),
    http2Option?: string(name='http2Option', description='The HTTP/2 configuration.

Valid values:

*   GlobalConfig
*   Close
*   Open', example='Open'),
    issuer?: string(name='issuer', description='The certificate issuer.', example='Alibaba'),
    mTLSEnabled?: boolean(name='mTLSEnabled', description='Indicates whether mutual authentication is enabled.

Valid values:

*   false
*   true', example='false'),
    name?: string(name='name', description='The domain name.', example='abc.com'),
    notAfterTimstamp?: long(name='notAfterTimstamp', description='The expiration time of the certificate.', example='1719386834548'),
    notBeforeTimestamp?: long(name='notBeforeTimestamp', description='The time when the certificate started to take effect.', example='1719386834548'),
    protocol?: string(name='protocol', description='The supported protocol. Valid values:

*   HTTP: Only HTTP is supported.
*   HTTPS: Only HTTPS is supported.', example='HTTP'),
    resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-aekzvlxzgo5b4si'),
    sans?: string(name='sans', description='All domain names that are bound to the certificate.', example='aliyun.com'),
    statisticsInfo?: {
      resourceStatistics?: [
        ResourceStatistic
      ](name='resourceStatistics', description='The resource statistics.'),
      totalCount?: string(name='totalCount', description='The total number of resources.', example='1'),
    }(name='statisticsInfo', description='The information about online resources.'),
    tlsCipherSuitesConfig?: TlsCipherSuitesConfig(name='tlsCipherSuitesConfig', description='The cipher suite configuration.'),
    tlsMax?: string(name='tlsMax', description='The maximum version of the TLS protocol. Up to TLS 1.3 is supported.', example='TLS 1.3'),
    tlsMin?: string(name='tlsMin', description='The minimum version of the TLS protocol. Down to TLS 1.0 is supported.', example='TLS 1.0'),
    updatetimestamp?: long(name='updatetimestamp', description='The update timestamp.', example='1719386834548'),
  }(name='data', description='The data returned.'),
  message?: string(name='message', description='The response message returned.', example='success'),
  requestId?: string(name='requestId', description='The request ID, which is used to trace the API call link.', example='3ACFC7A7-45A9-58CF-B2D5-765B60254695'),
}

model GetDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDomainResponseBody(name='body'),
}

/**
 * @summary Queries the information about a domain name.
 *
 * @param request GetDomainRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDomainResponse
 */
async function getDomainWithOptions(domainId: string, request: GetDomainRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDomainResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.withStatistics)) {
    query['withStatistics'] = request.withStatistics;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDomain',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/domains/${OpenApiUtil.getEncodeParam(domainId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about a domain name.
 *
 * @param request GetDomainRequest
 * @return GetDomainResponse
 */
async function getDomain(domainId: string, request: GetDomainRequest): GetDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDomainWithOptions(domainId, request, headers, runtime);
}

model GetEnvironmentRequest {
  withStatistics?: boolean(name='withStatistics', description='Indicates whether to return online resource info.', example='true'),
  withVpcInfo?: boolean(name='withVpcInfo', description='Option for vpc info.', example='true'),
}

model GetEnvironmentResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  data?: {
    alias?: string(name='alias', description='Environment alias.', example='测试环境'),
    createTimestamp?: long(name='createTimestamp', description='Creation timestamp.', example='1719386834548'),
    default?: boolean(name='default', description='Whether it is the default environment.', example='true'),
    description?: string(name='description', description='Environment description.', example='这是xxx的xx项目测试环境'),
    environmentId?: string(name='environmentId', description='Environment ID.', example='env-cq7l5s5lhtgi6qasrdc0'),
    gatewayInfo?: GatewayInfo(name='gatewayInfo', description='Gateway information'),
    name?: string(name='name', description='Environment name.', example='test'),
    resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group.', example='rg-aekzzzntl5njbpi'),
    statisticsInfo?: {
      resourceStatistics?: [
        ResourceStatistic
      ](name='resourceStatistics', description='The array of related resource information.'),
      totalCount?: int32(name='totalCount', description='The total number of entries returned.', example='4'),
    }(name='statisticsInfo', description='Related resource information.'),
    subDomainInfos?: [
      SubDomainInfo
    ](name='subDomainInfos', description='List of subdomains.'),
    updateTimestamp?: long(name='updateTimestamp', description='Update timestamp.', example='1719386834548'),
  }(name='data', description='Response data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID, used for tracing the API call chain.', example='3F8EE674-BB08-5E92-BE6F-E4756A748B0F'),
}

model GetEnvironmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetEnvironmentResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI GetEnvironment is deprecated
 *
 * @summary GetEnvironment
 *
 * @param request GetEnvironmentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetEnvironmentResponse
 */
// Deprecated
async function getEnvironmentWithOptions(environmentId: string, request: GetEnvironmentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetEnvironmentResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.withStatistics)) {
    query['withStatistics'] = request.withStatistics;
  }
  if (!Util.isUnset(request.withVpcInfo)) {
    query['withVpcInfo'] = request.withVpcInfo;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetEnvironment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/environments/${OpenApiUtil.getEncodeParam(environmentId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @deprecated OpenAPI GetEnvironment is deprecated
 *
 * @summary GetEnvironment
 *
 * @param request GetEnvironmentRequest
 * @return GetEnvironmentResponse
 */
// Deprecated
async function getEnvironment(environmentId: string, request: GetEnvironmentRequest): GetEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getEnvironmentWithOptions(environmentId, request, headers, runtime);
}

model GetGatewayResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    chargeType?: string(name='chargeType', description='Charge type
- POSTPAY: Postpaid (pay-as-you-go)
- PREPAY: Prepaid (subscription)', example='POSTPAY'),
    createFrom?: string(name='createFrom', description='Source of gateway creation:
- Console: Console.', example='Console'),
    createTimestamp?: long(name='createTimestamp', description='Creation timestamp. Unit: milliseconds.', example='1719386834548'),
    environments?: [ 
      {
        alias?: string(name='alias', description='The environment alias.', example='默认环境'),
        environmentId?: string(name='environmentId', description='Environment ID.', example='env-cp9uhudlht***'),
        name?: string(name='name', description='The environment name。', example='default-gw-cp9ugg5***'),
      }
    ](name='environments', description='List of environments associated with the gateway.'),
    expireTimestamp?: long(name='expireTimestamp', description='Expiration timestamp for subscription. Unit: milliseconds.', example='1719386834548'),
    gatewayId?: string(name='gatewayId', description='Gateway ID.', example='gw-cq2vundlhtg***'),
    loadBalancers?: [ 
      {
        address?: string(name='address', description='The address of the load balancer.', example='nlb-xoh3pghr***.cn-hangzhou.nlb.aliyuncs.com'),
        addressIpVersion?: string(name='addressIpVersion', description='The IP version of the protocol:
- ipv4: IPv4 type.
- ipv6: IPv6 type.', example='ipv4'),
        addressType?: string(name='addressType', description='Load balancer address type:
- Internet: Public.
- Intranet: Private.', example='Internet'),
        gatewayDefault?: boolean(name='gatewayDefault', description='Whether it is the default entry address for the gateway.', example='true'),
        loadBalancerId?: string(name='loadBalancerId', description='Load balancer ID.', example='nlb-xoh3pghru7c***'),
        mode?: string(name='mode', description='The provision mode of the load balancer for the gateway:
- Managed: Managed by the Cloud Native API Gateway.', example='Managed'),
        ports?: [ 
          {
            port?: int32(name='port', description='Port number.', example='443'),
            protocol?: string(name='protocol', description='Protocol:
- TCP
- UDP', example='TCP'),
          }
        ](name='ports', description='List of listening ports.'),
        status?: string(name='status', description='The status of the load balancer:
- Ready: Available.
- NotCreate: Not associated with an instance.', example='Ready'),
        type?: string(name='type', description='The type of load balancer:
- NLB: Network Load Balancer.
- CLB: Classic Load Balancer.', example='NLB'),
      }
    ](name='loadBalancers', description='List of entry addresses for the gateway.'),
    name?: string(name='name', description='Gateway name.', example='itemcenter-gateway'),
    replicas?: string(name='replicas', description='Number of gateway instance nodes.', example='2'),
    resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group.', example='rg-aek2s3cvc4jzfxi'),
    securityGroup?: {
      name?: string(name='name', description='Security group name.', example='APIG-sg-gw-cq7ke5ll***'),
      securityGroupId?: string(name='securityGroupId', description='Security group ID.', example='sg-bp16tafq9***'),
    }(name='securityGroup', description='The security group of the gateway.'),
    spec?: string(name='spec', description='Gateway specification:
- apigw.small.x1: Small specification.', example='apigw.small.x1'),
    status?: string(name='status', description='Gateway status:
- Running: Running.
- Creating: Creating.
- CreateFailed: Creation failed.
- Upgrading: Upgrading.
- UpgradeFailed: Upgrade failed.
- Restarting: Restarting.
- RestartFailed: Restart failed.
- Deleting: Deleting.
- DeleteFailed: Deletion failed.', example='Running'),
    tags?: [ 
      {
        key?: string(name='key', description='The tag key of the resource.', example='owner'),
        value?: string(name='value', description='The tag value of the resource.', example='zhangsan'),
      }
    ](name='tags', description='The resource tags.'),
    targetVersion?: string(name='targetVersion', description='Target version of the gateway. When it is inconsistent with the current version, an upgrade can be performed.', example='2.0.2'),
    updateTimestamp?: long(name='updateTimestamp', description='Update timestamp. Unit: milliseconds.', example='1719386834548'),
    vSwitch?: {
      name?: string(name='name', description='Virtual switch name.', example='杭州VPC虚拟交换机'),
      vSwitchId?: string(name='vSwitchId', description='Virtual switch ID.', example='vsw-bp1c7ggkj***'),
    }(name='vSwitch', description='The virtual switch associated with the gateway.'),
    version?: string(name='version', description='Gateway version.', example='2.0.2'),
    vpc?: {
      name?: string(name='name', description='VPC gateway name.', example='杭州VPC'),
      vpcId?: string(name='vpcId', description='VPC network ID.', example='vpc-bp1llj52lvj6xc***'),
    }(name='vpc', description='The VPC (Virtual Private Cloud) associated with the gateway.'),
    zones?: [ 
      {
        name?: string(name='name', description='Availability zone name.', example='杭州可用区E'),
        vSwitch?: {
          name?: string(name='name', description='Virtual switch name.', example='杭州VPC虚拟交换机'),
          vSwitchId?: string(name='vSwitchId', description='Virtual switch ID.', example='vsw-bp1c7ggkj***'),
        }(name='vSwitch', description='Virtual switch.'),
        zoneId?: string(name='zoneId', description='Availability zone ID.', example='cn-hangzhou-e'),
      }
    ](name='zones', description='List of availability zones associated with the gateway.'),
  }(name='data', description='Response data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='0F138FFC-6E2B-56C1-9BAB-A67462E339D1'),
}

model GetGatewayResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetGatewayResponseBody(name='body'),
}

/**
 * @summary Get a gateway.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetGatewayResponse
 */
async function getGatewayWithOptions(gatewayId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetGatewayResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetGateway',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Get a gateway.
 *
 * @return GetGatewayResponse
 */
async function getGateway(gatewayId: string): GetGatewayResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getGatewayWithOptions(gatewayId, headers, runtime);
}

model GetHttpApiResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: HttpApiApiInfo(name='data', description='API information.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='8FA9BB94-915B-5299-A694-49FCC7F5DD00'),
}

model GetHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHttpApiResponseBody(name='body'),
}

/**
 * @summary Read HttpApi
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHttpApiResponse
 */
async function getHttpApiWithOptions(httpApiId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetHttpApiResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Read HttpApi
 *
 * @return GetHttpApiResponse
 */
async function getHttpApi(httpApiId: string): GetHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHttpApiWithOptions(httpApiId, headers, runtime);
}

model GetHttpApiOperationResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: HttpApiOperationInfo(name='data', description='Operation information.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='B725275B-50C6-5A49-A9FD-F0332FCB3351'),
}

model GetHttpApiOperationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHttpApiOperationResponseBody(name='body'),
}

/**
 * @summary Get Operation
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHttpApiOperationResponse
 */
async function getHttpApiOperationWithOptions(httpApiId: string, operationId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetHttpApiOperationResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetHttpApiOperation',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/operations/${OpenApiUtil.getEncodeParam(operationId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Get Operation
 *
 * @return GetHttpApiOperationResponse
 */
async function getHttpApiOperation(httpApiId: string, operationId: string): GetHttpApiOperationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHttpApiOperationWithOptions(httpApiId, operationId, headers, runtime);
}

model GetHttpApiRouteResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: HttpRoute(name='data', description='The route details.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='3ACFC7A7-45A9-58CF-B2D5-765B60254695'),
}

model GetHttpApiRouteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHttpApiRouteResponseBody(name='body'),
}

/**
 * @summary Queries the details of a route of an HTTP API.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHttpApiRouteResponse
 */
async function getHttpApiRouteWithOptions(httpApiId: string, routeId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetHttpApiRouteResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetHttpApiRoute',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/routes/${OpenApiUtil.getEncodeParam(routeId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details of a route of an HTTP API.
 *
 * @return GetHttpApiRouteResponse
 */
async function getHttpApiRoute(httpApiId: string, routeId: string): GetHttpApiRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHttpApiRouteWithOptions(httpApiId, routeId, headers, runtime);
}

model GetPolicyResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: PolicyDetailInfo(name='data', description='The data returned.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='2F46B9E7-67EF-5C8A-BA52-D38D5B32A***'),
}

model GetPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPolicyResponseBody(name='body'),
}

/**
 * @summary Queries a policy.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPolicyResponse
 */
async function getPolicyWithOptions(policyId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPolicyResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPolicy',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v2/policies/${OpenApiUtil.getEncodeParam(policyId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a policy.
 *
 * @return GetPolicyResponse
 */
async function getPolicy(policyId: string): GetPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPolicyWithOptions(policyId, headers, runtime);
}

model GetPolicyAttachmentResponseBody = {
  code?: string(name='code', description='Response code.', example='200'),
  data?: {
    attachResourceId?: string(name='attachResourceId', description='Attached Resource ID', example='op-csbkd9llhtgqhqua***'),
    attachResourceType?: string(name='attachResourceType', description='Attached resource type, HttpApi, GatewayRoute, Operation, GatewayService, GatewayServicePort, Gateway, Domain', example='Operation'),
    config?: string(name='config', description='Policy attachment configuration', example='{"unitNum":1,"timeUnit":"s","enable":true}'),
    environmentId?: string(name='environmentId', description='Environment ID', example='env-cq7l5s5lhtgi6qa***'),
    gatewayId?: string(name='gatewayId', description='Gateway Instance ID', example='gw-cq2vundlhtg***'),
    policyAttachmentId?: string(name='policyAttachmentId', description='Policy Attachment ID', example='pr-cqoojualhtgquuj***'),
    policyId?: string(name='policyId', description='Policy ID', example='p-cq7l5s5bblhtgi6qas***'),
  }(name='data', description='Response data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='ID of the request', example='2C3B9A12-3868-5EB9-fBEA-F99E03DD1***'),
}

model GetPolicyAttachmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPolicyAttachmentResponseBody(name='body'),
}

/**
 * @summary Query Policy Resource Attachment
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPolicyAttachmentResponse
 */
async function getPolicyAttachmentWithOptions(policyAttachmentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPolicyAttachmentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPolicyAttachment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/policy-attachments/${OpenApiUtil.getEncodeParam(policyAttachmentId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Query Policy Resource Attachment
 *
 * @return GetPolicyAttachmentResponse
 */
async function getPolicyAttachment(policyAttachmentId: string): GetPolicyAttachmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPolicyAttachmentWithOptions(policyAttachmentId, headers, runtime);
}

model GetResourceOverviewResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    api?: {
      publishedCount?: long(name='publishedCount', description='Number of published APIs.', example='1'),
      totalCount?: long(name='totalCount', description='Number of APIs.', example='1'),
    }(name='api', description='API information.'),
    gateway?: {
      runningCount?: long(name='runningCount', description='Number of running gateways.', example='1'),
      totalCount?: long(name='totalCount', description='Number of gateway instances.', example='1'),
    }(name='gateway', description='Gateway information.'),
  }(name='data', description='Resource information.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='DD19A442-93C5-5C97-AFA0-B9C57EBD781B'),
}

model GetResourceOverviewResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceOverviewResponseBody(name='body'),
}

/**
 * @summary Get resource overview information
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceOverviewResponse
 */
async function getResourceOverviewWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceOverviewResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetResourceOverview',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/overview/resources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Get resource overview information
 *
 * @return GetResourceOverviewResponse
 */
async function getResourceOverview(): GetResourceOverviewResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceOverviewWithOptions(headers, runtime);
}

model GetServiceResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: Service(name='data', description='The service details.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='8FA9BB94-915B-5299-A694-49FCC7F5DD00'),
}

model GetServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetServiceResponseBody(name='body'),
}

/**
 * @summary Queries the details of a service.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetServiceResponse
 */
async function getServiceWithOptions(serviceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetServiceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetService',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/services/${OpenApiUtil.getEncodeParam(serviceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details of a service.
 *
 * @return GetServiceResponse
 */
async function getService(serviceId: string): GetServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getServiceWithOptions(serviceId, headers, runtime);
}

model GetTraceConfigRequest {
  acceptLanguage?: string(name='acceptLanguage', description='Language Type:
zh: Chinese
en: English', example='zh'),
}

model GetTraceConfigResponseBody = {
  code?: int32(name='code', description='Response Code', example='200'),
  data?: {
    enable?: boolean(name='enable', description='Whether to Enable Tracing:
true: Enabled
false: Disabled', example='true'),
    sampleRatio?: int32(name='sampleRatio', description='Sampling Rate', example='50'),
    serviceId?: string(name='serviceId', description='Service ID, present when the tracing type is SKYWALKING', example='ss-co370icmjeu****'),
    servicePort?: string(name='servicePort', description='服务端口，链路追踪类型为SKYWALKING时存在该参数', example='8090'),
    traceType?: string(name='traceType', description='Tracing Type:
- XTRACE
- SKYWALKING
- OPENTELEMETRY
- OTSKYWALKING', example='SKYWALKING'),
  }(name='data', description='Response Data'),
  message?: string(name='message', description='Error Message', example='success'),
  requestId?: string(name='requestId', description='Request ID', example='2F46B9E7-67EF-5C8A-BA52-D38D5B32AF2C'),
  success?: boolean(name='success', description='Boolean	Request Result, with the following values:
true: Request succeeded.
false: Request failed.', example='true'),
}

model GetTraceConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTraceConfigResponseBody(name='body'),
}

/**
 * @summary Retrieve Tracing Configuration
 *
 * @param request GetTraceConfigRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTraceConfigResponse
 */
async function getTraceConfigWithOptions(gatewayId: string, request: GetTraceConfigRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTraceConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['acceptLanguage'] = request.acceptLanguage;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTraceConfig',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/trace`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Retrieve Tracing Configuration
 *
 * @param request GetTraceConfigRequest
 * @return GetTraceConfigResponse
 */
async function getTraceConfig(gatewayId: string, request: GetTraceConfigRequest): GetTraceConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTraceConfigWithOptions(gatewayId, request, headers, runtime);
}

model ImportHttpApiRequest {
  description?: string(name='description', description='The API description, which cannot exceed 255 bytes in length. If you do not specify a description, a description is extracted from the definition file.', example='API for testing'),
  dryRun?: boolean(name='dryRun', description='Specifies whether to perform a dry run. If this parameter is set to true, a dry run is performed without importing the file.', example='false'),
  name?: string(name='name', description='The API name. If you do not specify a name, a name is extracted from the definition file. If a name and a versioning configuration already exist, the existing API definition is updated based on the strategy field.', example='import-test'),
  resourceGroupId?: string(name='resourceGroupId', description='[The resource group ID](https://help.aliyun.com/document_detail/151181.html).', example='rg-acfm3q4zjh7fkki'),
  specContentBase64?: string(name='specContentBase64', description='The Base64-encoded API definition. OAS 2.0 and OAS 3.0 specifications are supported. YAML and JSON formats are supported. This parameter precedes over the specFileUrl parameter. However, if the file size exceeds 10 MB, use the specFileUrl parameter to pass the definition.', example='b3BlbmFwaTogMy4wLjAKaW5mbzoKICAgIHRpdGxlOiBkZW1vCiAgICBkZXNjcmlwdGlvbjogdGhpc2lzZGVtbwogICAgdmVyc2lvbjogIiIKcGF0aHM6CiAgICAvdXNlci97dXNlcklkfToKICAgICAgICBnZXQ6CiAgICAgICAgICAgIHN1bW1hcnk6IOiOt+WPlueUqOaIt+S/oeaBrwogICAgICAgICAgICBkZXNjcmlwdGlvbjog6I635Y+W55So5oi35L+h5oGvCiAgICAgICAgICAgIG9wZXJhdGlvbklkOiBHZXRVc2VySW5mbwogICAgICAgICAgICByZXNwb25zZXM6CiAgICAgICAgICAgICAgICAiMjAwIjoKICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbjog5oiQ5YqfCiAgICAgICAgICAgICAgICAgICAgY29udGVudDoKICAgICAgICAgICAgICAgICAgICAgICAgYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PXV0Zi04OgogICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NoZW1hOiBudWxsCnNlcnZlcnM6CiAgICAtIHVybDogaHR0cDovL2FwaS5leGFtcGxlLmNvbS92MQo='),
  specFileUrl?: string(name='specFileUrl', description='The download URL of the API definition file. You can download the file over the Internet or by using an Object Storage Service (OSS) internal download URL that belongs to the current region. You must obtain the required permissions to download the file. For OSS URLs that are not publicly readable, refer to https://help.aliyun.com/zh/oss/user-guide/how-to-obtain-the-url-of-a-single-object-or-the-urls-of-multiple-objects to specify URLs that provide download permissions. Currently, only OSS URLs are supported.', example='https://my-bucket.oss-cn-hangzhou.aliyuncs.com/my-api/api.yaml'),
  specOssConfig?: {
    bucketName?: string(name='bucketName', description='The bucket name.', example='api-1'),
    objectKey?: string(name='objectKey', description='The full path of the file.', example='/test/swagger.json'),
    regionId?: string(name='regionId', description='The region ID.', example='cn-hangzhou'),
  }(name='specOssConfig', description='The OSS information.'),
  strategy?: string(name='strategy', description='The update policy when the API to be imported has the same version and name as an existing one. Valid values:

*   SpectOnly: All configurations in the file take effect.
*   SpecFirst: The file takes precedence. New APIs are created and existing ones are updated. APIs not included in the file remain unchanged.
*   ExistFirst (default): The existing APIs take precedence. New APIs are created but existing ones remain unchanged.', example='ExistFirst'),
  targetHttpApiId?: string(name='targetHttpApiId', description='The API to be updated. If this parameter is specified, this import updates only the specified API. New APIs are not created and unspecified existing APIs are not updated. Only REST APIs can be specified.', example='api-xxxx'),
  versionConfig?: HttpApiVersionConfig(name='versionConfig', description='Version configuration.'),
}

model ImportHttpApiResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    dryRunInfo?: {
      errorMessages?: [ string ](name='errorMessages', description='The error messages. If an error message is returned, the API fails to be imported.'),
      existHttpApiInfo?: HttpApiApiInfo(name='existHttpApiInfo', description='The existing APIs. If an existing API is returned, the import updates the existing API.'),
      failureComponents?: [ 
        {
          errorMessage?: string(name='errorMessage', description='The error message.', example='The data struct is incorrectly defined.'),
          name?: string(name='name', description='The data struct name.', example='orderDTO'),
        }
      ](name='failureComponents', description='The data structs that fail the dry run.'),
      failureOperations?: [ 
        {
          errorMessage?: string(name='errorMessage', description='The error message.', example='Missing response definition.'),
          method?: string(name='method', description='The HTTP method of the operation.', example='GET'),
          path?: string(name='path', description='The operation path.', example='/v1/orders'),
        }
      ](name='failureOperations', description='The operations that fail the dry run.'),
      successComponents?: [ 
        {
          action?: string(name='action', description='The action that will be performed for the data struct after the dry run.

*   Create: The data struct is created.
*   Update: The data struct is updated.', example='Create'),
          name?: string(name='name', description='The data struct name.', example='userDTO'),
        }
      ](name='successComponents', description='The data structs that pass the dry run.'),
      successOperations?: [ 
        {
          action?: string(name='action', description='The action that will be performed for the operation after the dry run.

*   Create: The operation is created.
*   Update: The operation is updated.', example='Create'),
          method?: string(name='method', description='The HTTP method of the operation.', example='POST'),
          name?: string(name='name', description='The operation name.', example='CreateUser'),
          path?: string(name='path', description='The operation path.', example='/v1/users'),
        }
      ](name='successOperations', description='The operations that pass the dry run.'),
      warningMessages?: [ string ](name='warningMessages', description='The alerts. If an alert is returned, specific operations or structs may fail to be imported.'),
    }(name='dryRunInfo', description='The dry run result.'),
    httpApiId?: string(name='httpApiId', description='The API ID.', example='api-xxx'),
    name?: string(name='name', description='The API name.', example='import-test'),
  }(name='data', description='The API information.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='CE857A85-251D-5018-8103-A38957D71E20'),
}

model ImportHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ImportHttpApiResponseBody(name='body'),
}

/**
 * @summary Imports HTTP APIs. You can call this operation to import OpenAPI 2.0 and OpenAPI 3.0.x definition files to create REST APIs.
 *
 * @param request ImportHttpApiRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ImportHttpApiResponse
 */
async function importHttpApiWithOptions(request: ImportHttpApiRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ImportHttpApiResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.dryRun)) {
    body['dryRun'] = request.dryRun;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    body['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.specContentBase64)) {
    body['specContentBase64'] = request.specContentBase64;
  }
  if (!Util.isUnset(request.specFileUrl)) {
    body['specFileUrl'] = request.specFileUrl;
  }
  if (!Util.isUnset(request.specOssConfig)) {
    body['specOssConfig'] = request.specOssConfig;
  }
  if (!Util.isUnset(request.strategy)) {
    body['strategy'] = request.strategy;
  }
  if (!Util.isUnset(request.targetHttpApiId)) {
    body['targetHttpApiId'] = request.targetHttpApiId;
  }
  if (!Util.isUnset(request.versionConfig)) {
    body['versionConfig'] = request.versionConfig;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ImportHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/import`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Imports HTTP APIs. You can call this operation to import OpenAPI 2.0 and OpenAPI 3.0.x definition files to create REST APIs.
 *
 * @param request ImportHttpApiRequest
 * @return ImportHttpApiResponse
 */
async function importHttpApi(request: ImportHttpApiRequest): ImportHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return importHttpApiWithOptions(request, headers, runtime);
}

model ListDomainsRequest {
  gatewayId?: string(name='gatewayId', description='The instance ID.', example='gw-xxx'),
  nameLike?: string(name='nameLike', description='The domain name keyword for fuzzy search.', example='test'),
  pageNumber?: int32(name='pageNumber', description='The page number of the page to return. Default value: 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page. Default value: 10.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The ID of the resource group.', example='rg-ahr5uil8raz0rq3b'),
}

model ListDomainsResponseBody = {
  code?: string(name='code', description='The status code returned.', example='Ok'),
  data?: {
    items?: [
      DomainInfo
    ](name='items', description='The information about the domain names.'),
    pageNumber?: int32(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
    totalSize?: int32(name='totalSize', description='The total number of entries returned.', example='9'),
  }(name='data', description='The response data.'),
  message?: string(name='message', description='The message returned.', example='success'),
  requestId?: string(name='requestId', description='The request ID, which is used to trace the API call link.', example='C61E30D3-579A-5B43-994E-31E02EDC9129'),
}

model ListDomainsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDomainsResponseBody(name='body'),
}

/**
 * @summary Queries a list of domain names.
 *
 * @param request ListDomainsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDomainsResponse
 */
async function listDomainsWithOptions(request: ListDomainsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDomainsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.gatewayId)) {
    query['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.nameLike)) {
    query['nameLike'] = request.nameLike;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDomains',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/domains`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of domain names.
 *
 * @param request ListDomainsRequest
 * @return ListDomainsResponse
 */
async function listDomains(request: ListDomainsRequest): ListDomainsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDomainsWithOptions(request, headers, runtime);
}

model ListEnvironmentsRequest {
  aliasLike?: string(name='aliasLike', description='Environment alias, fuzzy search.', example='测试'),
  gatewayId?: string(name='gatewayId', description='Gateway ID, exact search.', example='gw-cptv6ktlhtgnqr73h8d1'),
  gatewayNameLike?: string(name='gatewayNameLike', description='Gateway name, fuzzy search.', example='test-gw'),
  nameLike?: string(name='nameLike', description='Environment name, fuzzy search.', example='test'),
  pageNumber?: int32(name='pageNumber', description='Page number, default is 1.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, default is 10.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='Resource group ID.', example='rg-aek2sy66mftleiq'),
}

model ListEnvironmentsResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  data?: {
    items?: [
      EnvironmentInfo
    ](name='items', description='List of environment information.'),
    pageNumber?: int32(name='pageNumber', description='Page number.', example='1'),
    pageSize?: int32(name='pageSize', description='Number of items per page.', example='10'),
    totalSize?: int32(name='totalSize', description='Total number of items.', example='25'),
  }(name='data', description='Paged query environment list response.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID, used for tracing the call chain.', example='CE857A85-251D-5018-8103-A38957D71E20'),
}

model ListEnvironmentsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEnvironmentsResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI ListEnvironments is deprecated
 *
 * @summary ListEnvironments
 *
 * @param request ListEnvironmentsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEnvironmentsResponse
 */
// Deprecated
async function listEnvironmentsWithOptions(request: ListEnvironmentsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListEnvironmentsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.aliasLike)) {
    query['aliasLike'] = request.aliasLike;
  }
  if (!Util.isUnset(request.gatewayId)) {
    query['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.gatewayNameLike)) {
    query['gatewayNameLike'] = request.gatewayNameLike;
  }
  if (!Util.isUnset(request.nameLike)) {
    query['nameLike'] = request.nameLike;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListEnvironments',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/environments`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @deprecated OpenAPI ListEnvironments is deprecated
 *
 * @summary ListEnvironments
 *
 * @param request ListEnvironmentsRequest
 * @return ListEnvironmentsResponse
 */
// Deprecated
async function listEnvironments(request: ListEnvironmentsRequest): ListEnvironmentsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listEnvironmentsWithOptions(request, headers, runtime);
}

model ListGatewaysRequest {
  gatewayId?: string(name='gatewayId', description='The instance ID. If you specify an ID, an exact search is performed.', example='gw-cpv4sqdl****'),
  keyword?: string(name='keyword', description='The search keyword. A full match is performed. The search is case-insensitive.', example='dev'),
  name?: string(name='name', description='The instance name. If you specify a name, an exact search is performed.', example='itemcenter-gateway'),
  pageNumber?: int32(name='pageNumber', description='The number of the page to return.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-aekz3wes3hnre5a'),
  tag?: [ 
    {
      key?: string(name='key', description='The key of tag N.', example='owner'),
      value?: string(name='value', description='The value of tag N.', example='zhangsan'),
    }
  ](name='tag', description='The tags that you want to use for the search.'),
}

model ListGatewaysShrinkRequest {
  gatewayId?: string(name='gatewayId', description='The instance ID. If you specify an ID, an exact search is performed.', example='gw-cpv4sqdl****'),
  keyword?: string(name='keyword', description='The search keyword. A full match is performed. The search is case-insensitive.', example='dev'),
  name?: string(name='name', description='The instance name. If you specify a name, an exact search is performed.', example='itemcenter-gateway'),
  pageNumber?: int32(name='pageNumber', description='The number of the page to return.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-aekz3wes3hnre5a'),
  tagShrink?: string(name='tag', description='The tags that you want to use for the search.'),
}

model ListGatewaysResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    items?: [ 
      {
        chargeType?: string(name='chargeType', description='The billing method. Valid values:

*   POSTPAY: pay-as-you-go
*   PREPAY: subscription', example='POSTPAY'),
        createFrom?: string(name='createFrom', description='The creation source of the instance. Valid values:

*   Console', example='Console'),
        createTimestamp?: long(name='createTimestamp', description='The time when the instance was created. This value is a UNIX timestamp. Unit: milliseconds.', example='1719386834548'),
        expireTimestamp?: long(name='expireTimestamp', description='The time when the instance expires. This value is a UNIX timestamp. Unit: milliseconds.', example='172086834548'),
        gatewayId?: string(name='gatewayId', description='The instance ID.', example='gw-cpv54p5***'),
        loadBalancers?: [ 
          {
            address?: string(name='address', description='The load balancer IP address.', example='nlb-xoh3pghr***.cn-hangzhou.nlb.aliyuncs.com'),
            addressIpVersion?: string(name='addressIpVersion', description='The IP version of the address. Valid values:

*   ipv4: IPv4
*   ipv6: IPv6', example='ipv4'),
            addressType?: string(name='addressType', description='The address type. Valid values:

*   Internet
*   Intranet', example='Internet'),
            gatewayDefault?: boolean(name='gatewayDefault', description='Indicates whether the address is the default ingress address of the instance.', example='true'),
            loadBalancerId?: string(name='loadBalancerId', description='The load balancer ID.', example='nlb-xqwioje1c91r***'),
            mode?: string(name='mode', description='The mode in which the load balancer is provided. Valid values:

*   Managed: Cloud-native API Gateway manages and provides the load balancer.', example='Managed'),
            ports?: [ 
              {
                port?: int32(name='port', description='The port number.', example='443'),
                protocol?: string(name='protocol', description='The protocol. Valid values:

*   TCP
*   UDP', example='TCP'),
              }
            ](name='ports', description='The list of listened ports.'),
            status?: string(name='status', description='The load balancer status. Valid values:

*   Ready: The load balancer is available.
*   NotCreate: The load balancer is not associated with the instance.', example='Ready'),
            type?: string(name='type', description='The load balancer type. Valid values:

*   NLB: Network Load Balancer
*   CLB: Classic Load Balancer', example='NLB'),
          }
        ](name='loadBalancers', description='The ingress addresses of the instance.'),
        name?: string(name='name', description='The instance name.', example='itemcenter-gateway'),
        replicas?: string(name='replicas', description='The node quantity of the instance.', example='2'),
        resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-xxx'),
        securityGroup?: {
          securityGroupId?: string(name='securityGroupId', description='The security group ID.', example='sg-xxxx'),
        }(name='securityGroup', description='The security group information about the instance.'),
        spec?: string(name='spec', description='The instance specification. Valid values:

*   apigw.small.x1', example='apigw.small.x1'),
        status?: string(name='status', description='The instance state. Valid values:

*   Running: The instance is running.
*   Creating: The instance is being created.
*   CreateFailed: The instance fails to be created.
*   Upgrading: The instance is being upgraded.
*   UpgradeFailed: The instance fails to be upgraded.
*   Restarting: The instance is being restarted.
*   RestartFailed: The instance fails to be restarted.
*   Deleting: The instance is being released.
*   DeleteFailed: The instance failed to be released.', example='Running'),
        subDomainInfos?: [
          SubDomainInfo
        ](name='subDomainInfos', description='The second-level domain names.'),
        tags?: [ 
          {
            key?: string(name='key', description='The tag key.', example='owner'),
            value?: string(name='value', description='The tag value.', example='zhangsan'),
          }
        ](name='tags', description='The tags.'),
        targetVersion?: string(name='targetVersion', description='The destination version of the instance. If the value is inconsistent with the current version, you can upgrade the instance.', example='2.0.2'),
        updateTimestamp?: long(name='updateTimestamp', description='The time when the instance was last updated. This value is a UNIX timestamp. Unit: milliseconds.', example='1719386834548'),
        vSwitch?: {
          vSwitchId?: string(name='vSwitchId', description='The vSwitch ID.', example='vsw-xxxxx'),
        }(name='vSwitch', description='The vSwitch information.'),
        version?: string(name='version', description='The instance version.', example='2.0.2'),
        vpc?: {
          vpcId?: string(name='vpcId', description='The VPC ID.', example='vpc-xxxxx'),
        }(name='vpc', description='The virtual private cloud (VPC) information of the instance.'),
        zones?: [ 
          {
            vSwitch?: {
              vSwitchId?: string(name='vSwitchId', description='The vSwitch ID.', example='vsw-xxxxx'),
            }(name='vSwitch', description='The vSwitch information.'),
            zoneId?: string(name='zoneId', description='The zone ID.', example='cn-hangzhou-f'),
          }
        ](name='zones', description='The availability zones of the instance.'),
      }
    ](name='items', description='The instances.'),
    pageNumber?: int32(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
    totalSize?: long(name='totalSize', description='The total number of entries returned.', example='6'),
  }(name='data', description='The instances.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='5B626361-070A-56A7-B127-ADAC8F3655DB'),
}

model ListGatewaysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListGatewaysResponseBody(name='body'),
}

/**
 * @summary Queries a list of instances.
 *
 * @param tmpReq ListGatewaysRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListGatewaysResponse
 */
async function listGatewaysWithOptions(tmpReq: ListGatewaysRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListGatewaysResponse {
  Util.validateModel(tmpReq);
  var request = new ListGatewaysShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tag)) {
    request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'tag', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.gatewayId)) {
    query['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.keyword)) {
    query['keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tagShrink)) {
    query['tag'] = request.tagShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListGateways',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of instances.
 *
 * @param request ListGatewaysRequest
 * @return ListGatewaysResponse
 */
async function listGateways(request: ListGatewaysRequest): ListGatewaysResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listGatewaysWithOptions(request, headers, runtime);
}

model ListHttpApiOperationsRequest {
  consumerAuthorizationRuleId?: string(name='consumerAuthorizationRuleId', description='Filter the operation list based on a specific consumer authorization rule ID, and the interface list in the response only contains authorized operations.', example='cas-xxx'),
  method?: string(name='method', description='List interfaces by Method.', example='GET'),
  name?: string(name='name', description='Search operations by exact name.', example='getUserInfo'),
  nameLike?: string(name='nameLike', description='Search operations by name prefix.', example='GetUser'),
  pageNumber?: int32(name='pageNumber', description='Page number, starting from 1, default is 1 if not specified.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, valid range [1, 100], default is 10 if not specified.', example='10'),
  pathLike?: string(name='pathLike', description='Search operations by path prefix.', example='/v1'),
  withConsumerInEnvironmentId?: string(name='withConsumerInEnvironmentId', description='Each operation information in the response carries a list of authorization rules for the specified consumer under the specified environment ID. The withConsumerInEnvironmentId field needs to be additionally specified.', example='env-xxx'),
  withConsumerInfoById?: string(name='withConsumerInfoById', description='Each operation information in the response carries a list of authorization rules for the specified consumer under the specified environment ID. The withConsumerInEnvironmentId field needs to be additionally specified.', example='cs-xxx'),
  withPluginAttachmentByPluginId?: string(name='withPluginAttachmentByPluginId', description='Plugin ID, use this plugin ID to retrieve the plugin release information.', example='pl-xxx'),
}

model ListHttpApiOperationsResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    items?: [
      HttpApiOperationInfo
    ](name='items', description='List of operations.'),
    pageNumber?: int32(name='pageNumber', description='Page number.', example='1'),
    pageSize?: int32(name='pageSize', description='Page size.', example='10'),
    totalSize?: int32(name='totalSize', description='Total count.', example='10'),
  }(name='data', description='List of operations.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='585657D2-1C20-5B8A-AF17-D727C6490BE4'),
}

model ListHttpApiOperationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListHttpApiOperationsResponseBody(name='body'),
}

/**
 * @summary List Operations
 *
 * @param request ListHttpApiOperationsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListHttpApiOperationsResponse
 */
async function listHttpApiOperationsWithOptions(httpApiId: string, request: ListHttpApiOperationsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListHttpApiOperationsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.consumerAuthorizationRuleId)) {
    query['consumerAuthorizationRuleId'] = request.consumerAuthorizationRuleId;
  }
  if (!Util.isUnset(request.method)) {
    query['method'] = request.method;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.nameLike)) {
    query['nameLike'] = request.nameLike;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pathLike)) {
    query['pathLike'] = request.pathLike;
  }
  if (!Util.isUnset(request.withConsumerInEnvironmentId)) {
    query['withConsumerInEnvironmentId'] = request.withConsumerInEnvironmentId;
  }
  if (!Util.isUnset(request.withConsumerInfoById)) {
    query['withConsumerInfoById'] = request.withConsumerInfoById;
  }
  if (!Util.isUnset(request.withPluginAttachmentByPluginId)) {
    query['withPluginAttachmentByPluginId'] = request.withPluginAttachmentByPluginId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListHttpApiOperations',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/operations`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary List Operations
 *
 * @param request ListHttpApiOperationsRequest
 * @return ListHttpApiOperationsResponse
 */
async function listHttpApiOperations(httpApiId: string, request: ListHttpApiOperationsRequest): ListHttpApiOperationsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listHttpApiOperationsWithOptions(httpApiId, request, headers, runtime);
}

model ListHttpApiRoutesRequest {
  consumerAuthorizationRuleId?: string(name='consumerAuthorizationRuleId', description='The string that is used to filter routes based on consumer authentication rules. Only authorized APIs are returned.', example='cas-xxx'),
  deployStatuses?: string(name='deployStatuses', description='The deployment state of the route.

Enumerated values:

*   Deploying: The route is being deployed.
*   DeployedWithChanges: The route is deployed and modified.
*   Undeploying: The route is being undeployed.
*   NotDeployed: The route is not deployed.
*   Deployed: The route is deployed.
*   UndeployFailed: The route failed to be undeployed.
*   DeployFailed: The route failed to be deployed.', example='NotDeployed'),
  domainId?: string(name='domainId', description='Specifies to filter routes by domain ID.', example='d-xxx'),
  environmentId?: string(name='environmentId', description='The environment ID.', example='env-cpqnr6tlhtgubc***'),
  gatewayId?: string(name='gatewayId', description='The ID of the Cloud-native API Gateway instance.', example='gw-cpv4sqdl****'),
  name?: string(name='name', description='The route name.', example='itemcenter-gateway'),
  nameLike?: string(name='nameLike', description='The route name keyword for a fuzzy search.', example='item'),
  pageNumber?: int32(name='pageNumber', description='The page number of the page to return. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page. Valid values: 1 to 100. Default value: 10.', example='10'),
  pathLike?: string(name='pathLike', description='The route path keyword for a fuzzy search.', example='/v1'),
  withAuthPolicyInfo?: boolean(name='withAuthPolicyInfo', description='The consumer authorization information in the response.', example='true'),
  withConsumerInfoById?: string(name='withConsumerInfoById', description='The authentication rules of the specified consumer in each route returned.', example='cs-xxx'),
  withPluginAttachmentByPluginId?: string(name='withPluginAttachmentByPluginId', description='The mounting information of the specified plug-in in each route returned.', example='pl-xxx'),
}

model ListHttpApiRoutesResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    items?: [
      HttpRoute
    ](name='items', description='The routes.'),
    pageNumber?: int32(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: int32(name='pageSize', description='The number of entries per page.', example='20'),
    totalSize?: int32(name='totalSize', description='The total number of entries returned.', example='9'),
  }(name='data', description='The response parameters.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='CBEEB8C1-108E-50F0-9BEA-DED79553C309'),
}

model ListHttpApiRoutesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListHttpApiRoutesResponseBody(name='body'),
}

/**
 * @summary Queries the routes of an HTTP API.
 *
 * @param request ListHttpApiRoutesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListHttpApiRoutesResponse
 */
async function listHttpApiRoutesWithOptions(httpApiId: string, request: ListHttpApiRoutesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListHttpApiRoutesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.consumerAuthorizationRuleId)) {
    query['consumerAuthorizationRuleId'] = request.consumerAuthorizationRuleId;
  }
  if (!Util.isUnset(request.deployStatuses)) {
    query['deployStatuses'] = request.deployStatuses;
  }
  if (!Util.isUnset(request.domainId)) {
    query['domainId'] = request.domainId;
  }
  if (!Util.isUnset(request.environmentId)) {
    query['environmentId'] = request.environmentId;
  }
  if (!Util.isUnset(request.gatewayId)) {
    query['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.nameLike)) {
    query['nameLike'] = request.nameLike;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pathLike)) {
    query['pathLike'] = request.pathLike;
  }
  if (!Util.isUnset(request.withAuthPolicyInfo)) {
    query['withAuthPolicyInfo'] = request.withAuthPolicyInfo;
  }
  if (!Util.isUnset(request.withConsumerInfoById)) {
    query['withConsumerInfoById'] = request.withConsumerInfoById;
  }
  if (!Util.isUnset(request.withPluginAttachmentByPluginId)) {
    query['withPluginAttachmentByPluginId'] = request.withPluginAttachmentByPluginId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListHttpApiRoutes',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/routes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the routes of an HTTP API.
 *
 * @param request ListHttpApiRoutesRequest
 * @return ListHttpApiRoutesResponse
 */
async function listHttpApiRoutes(httpApiId: string, request: ListHttpApiRoutesRequest): ListHttpApiRoutesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listHttpApiRoutesWithOptions(httpApiId, request, headers, runtime);
}

model ListHttpApisRequest {
  gatewayId?: string(name='gatewayId', description='The ID of the Cloud-native API Gateway instance.', example='gw-cq2avtllh****'),
  keyword?: string(name='keyword', description='The search keyword. You can fuzzy-search by API name or exact-search by API ID.', example='test-'),
  name?: string(name='name', description='The API name that is used for the search. In this case, exact search is performed.', example='login'),
  pageNumber?: int32(name='pageNumber', description='The page number of the page to return. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page. Valid values: 1 to 100. Default value: 10.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-ahr5uil8raz0rq3b'),
  types?: string(name='types', description='The API type. You can specify multiple types and separate them with a comma (,).

*   Http
*   Rest
*   WebSocket
*   HttpIngress', example='Http,Rest'),
  withAPIsPublishedToEnvironment?: boolean(name='withAPIsPublishedToEnvironment'),
  withAuthPolicyInEnvironmentId?: string(name='withAuthPolicyInEnvironmentId', description='The consumer authentication policy in the specified environment in each returned API.', example='env-xxx'),
  withAuthPolicyList?: boolean(name='withAuthPolicyList', description='Specifies whether authentication is enabled.', example='true'),
  withConsumerInfoById?: string(name='withConsumerInfoById', description='The authorization rules of the specified consumer in each returned API.', example='cs-xxx'),
  withEnvironmentInfo?: boolean(name='withEnvironmentInfo', description='The environment information.', example='true'),
  withEnvironmentInfoById?: string(name='withEnvironmentInfoById', description='The environment ID.', example='env-ctovu5mm1hksb4q8ln40'),
  withIngressInfo?: boolean(name='withIngressInfo', description='The Ingress information.', example='false'),
  withPluginAttachmentByPluginId?: string(name='withPluginAttachmentByPluginId', description='The plug-in ID. You can use the returned value of this parameter to query the plug-in.', example='pl-ct9qn3um1hktue8dqol0'),
  withPolicyConfigs?: boolean(name='withPolicyConfigs'),
}

model ListHttpApisResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    items?: [
      HttpApiInfoByName
    ](name='items', description='The API information.'),
    pageNumber?: int32(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
    totalSize?: int32(name='totalSize', description='The total number of entries returned.', example='10'),
  }(name='data', description='The APIs.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='585657D2-1C20-5B8A-AF17-D727C6490BE4'),
}

model ListHttpApisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListHttpApisResponseBody(name='body'),
}

/**
 * @summary Queries a list of HTTP APIs.
 *
 * @param request ListHttpApisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListHttpApisResponse
 */
async function listHttpApisWithOptions(request: ListHttpApisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListHttpApisResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.gatewayId)) {
    query['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.keyword)) {
    query['keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.types)) {
    query['types'] = request.types;
  }
  if (!Util.isUnset(request.withAPIsPublishedToEnvironment)) {
    query['withAPIsPublishedToEnvironment'] = request.withAPIsPublishedToEnvironment;
  }
  if (!Util.isUnset(request.withAuthPolicyInEnvironmentId)) {
    query['withAuthPolicyInEnvironmentId'] = request.withAuthPolicyInEnvironmentId;
  }
  if (!Util.isUnset(request.withAuthPolicyList)) {
    query['withAuthPolicyList'] = request.withAuthPolicyList;
  }
  if (!Util.isUnset(request.withConsumerInfoById)) {
    query['withConsumerInfoById'] = request.withConsumerInfoById;
  }
  if (!Util.isUnset(request.withEnvironmentInfo)) {
    query['withEnvironmentInfo'] = request.withEnvironmentInfo;
  }
  if (!Util.isUnset(request.withEnvironmentInfoById)) {
    query['withEnvironmentInfoById'] = request.withEnvironmentInfoById;
  }
  if (!Util.isUnset(request.withIngressInfo)) {
    query['withIngressInfo'] = request.withIngressInfo;
  }
  if (!Util.isUnset(request.withPluginAttachmentByPluginId)) {
    query['withPluginAttachmentByPluginId'] = request.withPluginAttachmentByPluginId;
  }
  if (!Util.isUnset(request.withPolicyConfigs)) {
    query['withPolicyConfigs'] = request.withPolicyConfigs;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListHttpApis',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of HTTP APIs.
 *
 * @param request ListHttpApisRequest
 * @return ListHttpApisResponse
 */
async function listHttpApis(request: ListHttpApisRequest): ListHttpApisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listHttpApisWithOptions(request, headers, runtime);
}

model ListPolicyClassesRequest {
  attachResourceType?: string(name='attachResourceType', description='Types of attachment points supported by the policy.

- HttpApi: HttpApi.
- Operation: Operation of HttpApi.
- GatewayRoute: Gateway route.
- GatewayService: Gateway service.
- GatewayServicePort: Gateway service port.
- Domain: Gateway domain.
- Gateway: Gateway.', example='Operation'),
  direction?: string(name='direction', description='Direction of the policy.
- Outbound: OutBound.
- Inbound: InBound.
- Both directions: Both.', example='InBound'),
  pageNumber?: int32(name='pageNumber', description='Page number, default is 1.', example='1'),
  pageSize?: int32(name='pageSize', description='Page size', example='10'),
  type?: string(name='type', description='Type of the policy template.', example='FlowControl'),
}

model ListPolicyClassesResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  data?: {
    items?: [
      PolicyClassInfo
    ](name='items', description='List of policy templates'),
    pageNumber?: int32(name='pageNumber', description='Page number.', example='1'),
    pageSize?: int32(name='pageSize', description='Page size', example='10'),
    totalSize?: int32(name='totalSize', description='Total number of items.', example='10'),
  }(name='data', description='Policy template information.'),
  message?: string(name='message', description='ResponseMessage', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='23B45FA9-7208-5E55-B5CE-B6B2567DD822'),
}

model ListPolicyClassesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPolicyClassesResponseBody(name='body'),
}

/**
 * @summary ListPolicyClasses
 *
 * @param request ListPolicyClassesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPolicyClassesResponse
 */
async function listPolicyClassesWithOptions(request: ListPolicyClassesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPolicyClassesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.attachResourceType)) {
    query['attachResourceType'] = request.attachResourceType;
  }
  if (!Util.isUnset(request.direction)) {
    query['direction'] = request.direction;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPolicyClasses',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/policy-classes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary ListPolicyClasses
 *
 * @param request ListPolicyClassesRequest
 * @return ListPolicyClassesResponse
 */
async function listPolicyClasses(request: ListPolicyClassesRequest): ListPolicyClassesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPolicyClassesWithOptions(request, headers, runtime);
}

model ListServicesRequest {
  gatewayId?: string(name='gatewayId', description='The ID of the Cloud-native API Gateway instance.', example='gw-cpv4sqdl*****'),
  name?: string(name='name', description='The service name.', example='user-service'),
  pageNumber?: int32(name='pageNumber', description='The page number to return. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='pageSize', description='The number of entries per page. Valid values: 1 to 100. Default value: 10.', example='10'),
  resourceGroupId?: string(name='resourceGroupId', description='The resource group ID.', example='rg-acfmxxe5rc6cvla'),
  sourceType?: string(name='sourceType', description='The service source. Valid values:

*   MSE_NACOS: a service in an MSE Nacos instance
*   K8S: a service in a Kubernetes (K8s) cluster in Container Service for Kubernetes (ACK)
*   FC3: a service in Function Compute
*   VIP: a fixed address
*   DNS: a domain name

Enumerated values:

*   K8S
*   FC3
*   DNS
*   VIP
*   MSE_NACOS', example='MSE_NACOS'),
  sourceTypes?: string(name='sourceTypes'),
}

model ListServicesResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    items?: [
      Service
    ](name='items', description='The services.'),
    pageNumber?: int32(name='pageNumber', description='The page number of the returned page.', example='1'),
    pageSize?: int32(name='pageSize', description='The number of entries per page.', example='10'),
    totalSize?: int32(name='totalSize', description='The total number of entries returned.', example='18'),
  }(name='data', description='The response parameters.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='585657D2-1C20-5B8A-AF17-D727C6490BE4'),
}

model ListServicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListServicesResponseBody(name='body'),
}

/**
 * @summary Queries a list of services.
 *
 * @param request ListServicesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListServicesResponse
 */
async function listServicesWithOptions(request: ListServicesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListServicesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.gatewayId)) {
    query['gatewayId'] = request.gatewayId;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.sourceType)) {
    query['sourceType'] = request.sourceType;
  }
  if (!Util.isUnset(request.sourceTypes)) {
    query['sourceTypes'] = request.sourceTypes;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListServices',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/services`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of services.
 *
 * @param request ListServicesRequest
 * @return ListServicesResponse
 */
async function listServices(request: ListServicesRequest): ListServicesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listServicesWithOptions(request, headers, runtime);
}

model ListSslCertsRequest {
  certNameLike?: string(name='certNameLike', description='Name matching keyword.', example='ali'),
  domainName?: string(name='domainName', description='Domain name.', example='fun.iot.evideocloud.com.cn'),
  pageNumber?: int32(name='pageNumber', description='Page number, default is 1', example='1'),
  pageSize?: int32(name='pageSize', description='Page size, default is 10', example='10'),
}

model ListSslCertsResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    items?: [
      SslCertMetaInfo
    ](name='items', description='List of certificate information.'),
    pageNumber?: int32(name='pageNumber', description='Page number.', example='1'),
    pageSize?: int32(name='pageSize', description='Page size.', example='10'),
    totalSize?: int32(name='totalSize', description='Total count.', example='2'),
  }(name='data', description='Returned data'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='AADF7197-3384-52AF-A2DE-A66696734129'),
}

model ListSslCertsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSslCertsResponseBody(name='body'),
}

/**
 * @summary ListSslCerts
 *
 * @param request ListSslCertsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSslCertsResponse
 */
async function listSslCertsWithOptions(request: ListSslCertsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSslCertsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.certNameLike)) {
    query['certNameLike'] = request.certNameLike;
  }
  if (!Util.isUnset(request.domainName)) {
    query['domainName'] = request.domainName;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSslCerts',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/ssl/certs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary ListSslCerts
 *
 * @param request ListSslCertsRequest
 * @return ListSslCertsResponse
 */
async function listSslCerts(request: ListSslCertsRequest): ListSslCertsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSslCertsWithOptions(request, headers, runtime);
}

model ListZonesResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  data?: {
    items?: [ 
      {
        zoneId?: string(name='zoneId', description='可用区ID。', example='cn-shenzhen-c'),
      }
    ](name='items', description='List of availability zones.'),
  }(name='data', description='Returned data.'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='E8079207-B651-592A-A565-23E9EE5673B0'),
}

model ListZonesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListZonesResponseBody(name='body'),
}

/**
 * @summary Retrieve the availability zones under a cloud-native API gateway region
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListZonesResponse
 */
async function listZonesWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListZonesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListZones',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/zones`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Retrieve the availability zones under a cloud-native API gateway region
 *
 * @return ListZonesResponse
 */
async function listZones(): ListZonesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listZonesWithOptions(headers, runtime);
}

model RestartGatewayResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='585657D2-1C20-5B8A-AF17-D727C6490BE4'),
}

model RestartGatewayResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RestartGatewayResponseBody(name='body'),
}

/**
 * @summary Gateway Restart
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RestartGatewayResponse
 */
async function restartGatewayWithOptions(gatewayId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RestartGatewayResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RestartGateway',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/restart`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Gateway Restart
 *
 * @return RestartGatewayResponse
 */
async function restartGateway(gatewayId: string): RestartGatewayResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return restartGatewayWithOptions(gatewayId, headers, runtime);
}

model UndeployHttpApiRequest {
  environmentId?: string(name='environmentId', description='The environment ID.', example='env-cqsmtellhtgvo***'),
  routeId?: string(name='routeId', description='Route ID. This must be provided when publishing the route of an HTTP API.', example='hr-cr82undlhtgrle***'),
}

model UndeployHttpApiResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='3ACFC7A7-45A9-58CF-B2D5-765B60254695'),
}

model UndeployHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UndeployHttpApiResponseBody(name='body'),
}

/**
 * @summary 取消部署HttpApi
 *
 * @param request UndeployHttpApiRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UndeployHttpApiResponse
 */
async function undeployHttpApiWithOptions(httpApiId: string, request: UndeployHttpApiRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UndeployHttpApiResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.environmentId)) {
    body['environmentId'] = request.environmentId;
  }
  if (!Util.isUnset(request.routeId)) {
    body['routeId'] = request.routeId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UndeployHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/undeploy`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 取消部署HttpApi
 *
 * @param request UndeployHttpApiRequest
 * @return UndeployHttpApiResponse
 */
async function undeployHttpApi(httpApiId: string, request: UndeployHttpApiRequest): UndeployHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return undeployHttpApiWithOptions(httpApiId, request, headers, runtime);
}

model UpdateDomainRequest {
  caCertIdentifier?: string(name='caCertIdentifier', description='The CA certificate ID.', example='1ef1da5f-38ed-69b3-****-037781890265'),
  certIdentifier?: string(name='certIdentifier', description='The certificate ID.', example='1ef1da5f-38ed-69b3-****-037781890265'),
  clientCACert?: string(name='clientCACert', description='The client CA certificate.', example='-----BEGIN CERTIFICATE-----
MIIFBTCCAu2gAwIBAgIUORLpYPGSFD1YOP6PMbE7Wd/mpTQwDQYJKoZIhvcNAQEL
BQAwE************************************************2VwVOJ2gqX3
YuGaxvIbDy0iQJ1GMerPRyzJTeVEtdIKT29u0PdFRr4KZWom35qX7G4=
-----END CERTIFICATE-----'),
  forceHttps?: boolean(name='forceHttps', description='Specifies whether to enable HTTPS redirection. If protocol is set to HTTPS, forceHttps is required.', example='false'),
  http2Option?: string(name='http2Option', description='The HTTP/2 configuration.

Enumerated values:

*   GlobalConfig
*   Close
*   Open', example='Open'),
  mTLSEnabled?: boolean(name='mTLSEnabled', description='Specifies whether to enable mutual TLS (mTLS) authentication.'),
  protocol?: string(name='protocol', description='The protocol type to be supported by the domain name. Valid values:

*   HTTP
*   HTTPS

This parameter is required.', example='HTTP'),
  tlsCipherSuitesConfig?: TlsCipherSuitesConfig(name='tlsCipherSuitesConfig', description='The cipher suite configuration.'),
  tlsMax?: string(name='tlsMax', description='The maximum TLS version. Up to TLS 1.3 is supported.', example='TLS 1.3'),
  tlsMin?: string(name='tlsMin', description='The minimum TLS version. Down to TLS 1.0 is supported.', example='TLS 1.0'),
}

model UpdateDomainResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  data?: {
    deployRevisionId?: string(name='deployRevisionId', description='The released version ID.', example='apr-xxx'),
  }(name='data', description='The response parameters.'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID. You can use this value to trace the API call.', example='4BACB05C-3FE2-588F-9148-700C5C026B74'),
}

model UpdateDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDomainResponseBody(name='body'),
}

/**
 * @summary Updates a domain name.
 *
 * @param request UpdateDomainRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDomainResponse
 */
async function updateDomainWithOptions(domainId: string, request: UpdateDomainRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateDomainResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.caCertIdentifier)) {
    body['caCertIdentifier'] = request.caCertIdentifier;
  }
  if (!Util.isUnset(request.certIdentifier)) {
    body['certIdentifier'] = request.certIdentifier;
  }
  if (!Util.isUnset(request.clientCACert)) {
    body['clientCACert'] = request.clientCACert;
  }
  if (!Util.isUnset(request.forceHttps)) {
    body['forceHttps'] = request.forceHttps;
  }
  if (!Util.isUnset(request.http2Option)) {
    body['http2Option'] = request.http2Option;
  }
  if (!Util.isUnset(request.mTLSEnabled)) {
    body['mTLSEnabled'] = request.mTLSEnabled;
  }
  if (!Util.isUnset(request.protocol)) {
    body['protocol'] = request.protocol;
  }
  if (!Util.isUnset(request.tlsCipherSuitesConfig)) {
    body['tlsCipherSuitesConfig'] = request.tlsCipherSuitesConfig;
  }
  if (!Util.isUnset(request.tlsMax)) {
    body['tlsMax'] = request.tlsMax;
  }
  if (!Util.isUnset(request.tlsMin)) {
    body['tlsMin'] = request.tlsMin;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDomain',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/domains/${OpenApiUtil.getEncodeParam(domainId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a domain name.
 *
 * @param request UpdateDomainRequest
 * @return UpdateDomainResponse
 */
async function updateDomain(domainId: string, request: UpdateDomainRequest): UpdateDomainResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateDomainWithOptions(domainId, request, headers, runtime);
}

model UpdateEnvironmentRequest {
  alias?: string(name='alias', description='Environment alias.

This parameter is required.', example='测试环境'),
  description?: string(name='description', description='Description of the environment, which can include information such as the purpose of the environment and its users.', example='这是xx的xx项目测试环境'),
}

model UpdateEnvironmentResponseBody = {
  code?: string(name='code', description='Response code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID, used for tracing the API call chain.', example='52FB803B-3CD8-5FF8-AAE9-C2B841F6A483'),
}

model UpdateEnvironmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateEnvironmentResponseBody(name='body'),
}

/**
 * @deprecated OpenAPI UpdateEnvironment is deprecated
 *
 * @summary UpdateEnvironment
 *
 * @param request UpdateEnvironmentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateEnvironmentResponse
 */
// Deprecated
async function updateEnvironmentWithOptions(environmentId: string, request: UpdateEnvironmentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateEnvironmentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.alias)) {
    body['alias'] = request.alias;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateEnvironment',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/environments/${OpenApiUtil.getEncodeParam(environmentId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @deprecated OpenAPI UpdateEnvironment is deprecated
 *
 * @summary UpdateEnvironment
 *
 * @param request UpdateEnvironmentRequest
 * @return UpdateEnvironmentResponse
 */
// Deprecated
async function updateEnvironment(environmentId: string, request: UpdateEnvironmentRequest): UpdateEnvironmentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateEnvironmentWithOptions(environmentId, request, headers, runtime);
}

model UpdateGatewayFeatureRequest {
  value?: string(name='value', description='Parameter value.', example='"true"'),
}

model UpdateGatewayFeatureResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='043360DA-ED3B-5386-9B7A-D94DECF99A30'),
}

model UpdateGatewayFeatureResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateGatewayFeatureResponseBody(name='body'),
}

/**
 * @summary Get the feature configuration of the gateway
 *
 * @param request UpdateGatewayFeatureRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateGatewayFeatureResponse
 */
async function updateGatewayFeatureWithOptions(gatewayId: string, name: string, request: UpdateGatewayFeatureRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateGatewayFeatureResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.value)) {
    body['value'] = request.value;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateGatewayFeature',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/gateway-features/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Get the feature configuration of the gateway
 *
 * @param request UpdateGatewayFeatureRequest
 * @return UpdateGatewayFeatureResponse
 */
async function updateGatewayFeature(gatewayId: string, name: string, request: UpdateGatewayFeatureRequest): UpdateGatewayFeatureResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateGatewayFeatureWithOptions(gatewayId, name, request, headers, runtime);
}

model UpdateGatewayNameRequest {
  name?: string(name='name', description='Gateway name.', example='dev-itemcenter-router'),
}

model UpdateGatewayNameResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='585657D2-1C20-5B8A-AF17-D727C6490BE4'),
}

model UpdateGatewayNameResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateGatewayNameResponseBody(name='body'),
}

/**
 * @summary Change the name of a gateway instance
 *
 * @param request UpdateGatewayNameRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateGatewayNameResponse
 */
async function updateGatewayNameWithOptions(gatewayId: string, request: UpdateGatewayNameRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateGatewayNameResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateGatewayName',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/name`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Change the name of a gateway instance
 *
 * @param request UpdateGatewayNameRequest
 * @return UpdateGatewayNameResponse
 */
async function updateGatewayName(gatewayId: string, request: UpdateGatewayNameRequest): UpdateGatewayNameResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateGatewayNameWithOptions(gatewayId, request, headers, runtime);
}

model UpdateHttpApiRequest {
  aiProtocols?: [ string ](name='aiProtocols', description='The AI protocols.'),
  authConfig?: AuthConfig(name='authConfig', description='The authentication configuration.'),
  basePath?: string(name='basePath', description='The API base path, which must start with a forward slash (/).

This parameter is required.', example='/v1'),
  deployConfigs?: [
    HttpApiDeployConfig
  ](name='deployConfigs', description='The deployment configurations.'),
  description?: string(name='description', description='The API description.', example='API for testing'),
  enableAuth?: boolean(name='enableAuth', description='Specifies whether to enable authentication.'),
  ingressConfig?: {
    environmentId?: string(name='environmentId', description='The environment ID.', example='env-cr6ql0tlhtgmc****'),
    ingressClass?: string(name='ingressClass', description='The Ingress class for listening.', example='mse'),
    overrideIngressIp?: boolean(name='overrideIngressIp', description='Specifies whether to update the address in Ingress Status.', example='false'),
    sourceId?: string(name='sourceId', description='The source ID.', example='src-crdddallhtgtr****'),
    watchNamespace?: string(name='watchNamespace', description='The namespace for listening.', example='default'),
  }(name='ingressConfig', description='The HTTP Ingress API configurations.'),
  protocols?: [ string ](name='protocols', description='The protocols that are used to access the API.'),
  versionConfig?: HttpApiVersionConfig(name='versionConfig', description='The versioning configurations.'),
}

model UpdateHttpApiResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='393E2630-DBE7-5221-AB35-9E740675491A'),
}

model UpdateHttpApiResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateHttpApiResponseBody(name='body'),
}

/**
 * @summary Updates an HTTP API.
 *
 * @param request UpdateHttpApiRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateHttpApiResponse
 */
async function updateHttpApiWithOptions(httpApiId: string, request: UpdateHttpApiRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateHttpApiResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.aiProtocols)) {
    body['aiProtocols'] = request.aiProtocols;
  }
  if (!Util.isUnset(request.authConfig)) {
    body['authConfig'] = request.authConfig;
  }
  if (!Util.isUnset(request.basePath)) {
    body['basePath'] = request.basePath;
  }
  if (!Util.isUnset(request.deployConfigs)) {
    body['deployConfigs'] = request.deployConfigs;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.enableAuth)) {
    body['enableAuth'] = request.enableAuth;
  }
  if (!Util.isUnset(request.ingressConfig)) {
    body['ingressConfig'] = request.ingressConfig;
  }
  if (!Util.isUnset(request.protocols)) {
    body['protocols'] = request.protocols;
  }
  if (!Util.isUnset(request.versionConfig)) {
    body['versionConfig'] = request.versionConfig;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateHttpApi',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates an HTTP API.
 *
 * @param request UpdateHttpApiRequest
 * @return UpdateHttpApiResponse
 */
async function updateHttpApi(httpApiId: string, request: UpdateHttpApiRequest): UpdateHttpApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateHttpApiWithOptions(httpApiId, request, headers, runtime);
}

model UpdateHttpApiOperationRequest {
  operation?: HttpApiOperation(name='operation', description='operation definition.'),
}

model UpdateHttpApiOperationResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='043360DA-ED3B-5386-9B7A-D94DECF99A30'),
}

model UpdateHttpApiOperationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateHttpApiOperationResponseBody(name='body'),
}

/**
 * @summary Update Operation
 *
 * @param request UpdateHttpApiOperationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateHttpApiOperationResponse
 */
async function updateHttpApiOperationWithOptions(httpApiId: string, operationId: string, request: UpdateHttpApiOperationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateHttpApiOperationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.operation)) {
    body['operation'] = request.operation;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateHttpApiOperation',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/operations/${OpenApiUtil.getEncodeParam(operationId)}`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Update Operation
 *
 * @param request UpdateHttpApiOperationRequest
 * @return UpdateHttpApiOperationResponse
 */
async function updateHttpApiOperation(httpApiId: string, operationId: string, request: UpdateHttpApiOperationRequest): UpdateHttpApiOperationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateHttpApiOperationWithOptions(httpApiId, operationId, request, headers, runtime);
}

model UpdateHttpApiRouteRequest {
  backendConfig?: {
    scene?: string(name='scene', description='The backend service scenario.

Valid values:

*   SingleService
*   MultiServiceByRatio
*   Redirect
*   Mock', example='SingleService'),
    services?: [ 
      {
        port?: int32(name='port', description='The service port. If you want to use a dynamic port, do not pass this parameter.', example='8080'),
        protocol?: string(name='protocol', description='The protocol. Valid values:

*   HTTP
*   HTTPS', example='HTTP'),
        serviceId?: string(name='serviceId', description='The service ID.', example='svc-cr6pk4tlhtgm58e***'),
        version?: string(name='version', description='The service version.', example='v1'),
        weight?: int32(name='weight', description='The percentage value of traffic.', example='49'),
      }
    ](name='services', description='The backend services.'),
  }(name='backendConfig', description='The backend service configurations of the route.'),
  description?: string(name='description', description='The route description.', example='test route'),
  domainIds?: [ string ](name='domainIds', description='The domain IDs.'),
  environmentId?: string(name='environmentId', description='The environment ID.', example='env-cquqsollhtgid***'),
  match?: HttpRouteMatch(name='match', description='The rules for matching the route.'),
}

model UpdateHttpApiRouteResponseBody = {
  code?: string(name='code', description='The status code.', example='Ok'),
  message?: string(name='message', description='The returned message.', example='success'),
  requestId?: string(name='requestId', description='The request ID.', example='CBEEB8C1-108E-50F0-9BEA-DED79553C309'),
}

model UpdateHttpApiRouteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateHttpApiRouteResponseBody(name='body'),
}

/**
 * @summary Updates the route of an HTTP API.
 *
 * @param request UpdateHttpApiRouteRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateHttpApiRouteResponse
 */
async function updateHttpApiRouteWithOptions(httpApiId: string, routeId: string, request: UpdateHttpApiRouteRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateHttpApiRouteResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.backendConfig)) {
    body['backendConfig'] = request.backendConfig;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.domainIds)) {
    body['domainIds'] = request.domainIds;
  }
  if (!Util.isUnset(request.environmentId)) {
    body['environmentId'] = request.environmentId;
  }
  if (!Util.isUnset(request.match)) {
    body['match'] = request.match;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateHttpApiRoute',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/http-apis/${OpenApiUtil.getEncodeParam(httpApiId)}/routes/${OpenApiUtil.getEncodeParam(routeId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates the route of an HTTP API.
 *
 * @param request UpdateHttpApiRouteRequest
 * @return UpdateHttpApiRouteResponse
 */
async function updateHttpApiRoute(httpApiId: string, routeId: string, request: UpdateHttpApiRouteRequest): UpdateHttpApiRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateHttpApiRouteWithOptions(httpApiId, routeId, request, headers, runtime);
}

model UpdatePolicyRequest {
  config?: string(name='config', description='Policy configuration

This parameter is required.', example='{"unitNum":1,"timeUnit":"s","enable":true}'),
  description?: string(name='description', description='Description', example='this is a timeout policy description'),
  name?: string(name='name', description='Policy name

This parameter is required.', example='celue-timeout-test'),
}

model UpdatePolicyResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='C67DED2B-F19B-5BEC-88C1-D6EB854C***'),
}

model UpdatePolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdatePolicyResponseBody(name='body'),
}

/**
 * @summary Update Policy
 *
 * @param request UpdatePolicyRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdatePolicyResponse
 */
async function updatePolicyWithOptions(policyId: string, request: UpdatePolicyRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdatePolicyResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.config)) {
    body['config'] = request.config;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    body['name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdatePolicy',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v2/policies/${OpenApiUtil.getEncodeParam(policyId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Update Policy
 *
 * @param request UpdatePolicyRequest
 * @return UpdatePolicyResponse
 */
async function updatePolicy(policyId: string, request: UpdatePolicyRequest): UpdatePolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updatePolicyWithOptions(policyId, request, headers, runtime);
}

model UpgradeGatewayRequest {
  version?: string(name='version', description='Gateway version.', example='2.0.2'),
}

model UpgradeGatewayResponseBody = {
  code?: string(name='code', description='Response status code.', example='Ok'),
  message?: string(name='message', description='Response message.', example='success'),
  requestId?: string(name='requestId', description='Request ID.', example='043360DA-ED3B-5386-9B7A-D94DECF99A30'),
}

model UpgradeGatewayResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeGatewayResponseBody(name='body'),
}

/**
 * @summary Upgrade the gateway version
 *
 * @param request UpgradeGatewayRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeGatewayResponse
 */
async function upgradeGatewayWithOptions(gatewayId: string, request: UpgradeGatewayRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpgradeGatewayResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.version)) {
    query['version'] = request.version;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeGateway',
    version = '2024-03-27',
    protocol = 'HTTPS',
    pathname = `/v1/gateways/${OpenApiUtil.getEncodeParam(gatewayId)}/upgrade`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Upgrade the gateway version
 *
 * @param request UpgradeGatewayRequest
 * @return UpgradeGatewayResponse
 */
async function upgradeGateway(gatewayId: string, request: UpgradeGatewayRequest): UpgradeGatewayResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return upgradeGatewayWithOptions(gatewayId, request, headers, runtime);
}

